Closed jkreuz closed 10 months ago
The current default code is for HQ-SAM. To use the original SAM, you will need to comment out the paragraphs starting with "# HQ-SAM". Also uncomment the "Segment-anything" paragraphs like this.
# Uncomment the following lines to generate preprocessing model of Segment-anything
import segment_anything as SAM
# Download Segment-anything model "sam_vit_h_4b8939.pth" from https://github.com/facebookresearch/segment-anything#model-checkpoints
# and change the path below
checkpoint = 'sam_vit_h_4b8939.pth'
model_type = 'vit_h'
output_path = 'models/sam_preprocess.onnx'
quantize = True
# Mobile-SAM
# # Download Mobile-SAM model "mobile_sam.pt" from https://github.com/ChaoningZhang/MobileSAM/blob/master/weights/mobile_sam.pt
# import mobile_sam as SAM
# checkpoint = 'mobile_sam.pt'
# model_type = 'vit_t'
# output_path = 'models/mobile_sam_preprocess.onnx'
# quantize = False
# HQ-SAM
# # Download Mobile-SAM model "sam_hq_vit_h.pt" from https://github.com/SysCV/sam-hq#model-checkpoints
# # Installation: https://github.com/SysCV/sam-hq#quick-installation-via-pip
# import segment_anything as SAM
# checkpoint = 'sam_hq_vit_h.pth'
# model_type = 'vit_h'
# output_path = 'models/sam_hq_preprocess.onnx'
# quantize = True
# output_names = ['output', 'interm_embeddings']
Hello, I'm trying to generate the onnx preprocessing models and I'm having the following error:
I tested with the vit_b and vit_h models from https://github.com/facebookresearch/segment-anything/ and the error appear for both. I installed the segment_anything library direct from the Meta github with pip.