-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
convert_all_meta_sam.sh
37 lines (34 loc) · 1.7 KB
/
convert_all_meta_sam.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
echo "Converting all models..."
echo "Converting ViT-H models..."
python -m samexporter.export_encoder --checkpoint original_models/sam_vit_h_4b8939.pth \
--output output_models/sam_vit_h_4b8939.encoder.onnx \
--model-type vit_h \
--quantize-out output_models/sam_vit_h_4b8939.encoder.quant.onnx \
--use-preprocess
python -m samexporter.export_decoder --checkpoint original_models/sam_vit_h_4b8939.pth \
--output output_models/sam_vit_h_4b8939.decoder.onnx \
--model-type vit_h \
--quantize-out output_models/sam_vit_h_4b8939.decoder.quant.onnx \
--return-single-mask
echo "Converting ViT-L models..."
python -m samexporter.export_encoder --checkpoint original_models/sam_vit_l_0b3195.pth \
--output output_models/sam_vit_l_0b3195.encoder.onnx \
--model-type vit_l \
--quantize-out output_models/sam_vit_l_0b3195.encoder.quant.onnx \
--use-preprocess
python -m samexporter.export_decoder --checkpoint original_models/sam_vit_l_0b3195.pth \
--output output_models/sam_vit_l_0b3195.decoder.onnx \
--model-type vit_l \
--quantize-out output_models/sam_vit_l_0b3195.decoder.quant.onnx \
--return-single-mask
echo "Converting ViT-B models..."
python -m samexporter.export_encoder --checkpoint original_models/sam_vit_b_01ec64.pth \
--output output_models/sam_vit_b_01ec64.encoder.onnx \
--model-type vit_b \
--quantize-out output_models/sam_vit_b_01ec64.encoder.quant.onnx \
--use-preprocess
python -m samexporter.export_decoder --checkpoint original_models/sam_vit_b_01ec64.pth \
--output output_models/sam_vit_b_01ec64.decoder.onnx \
--model-type vit_b \
--quantize-out output_models/sam_vit_b_01ec64.decoder.quant.onnx \
--return-single-mask