WisconsinAIVision / yolact_edge

The first competitive instance segmentation approach that runs on small edge devices at real-time speeds.
MIT License
1.27k stars 273 forks source link

Demo Colab not running: "We initialize the network and load a pre-trained model" #189

Open jitaxis opened 2 years ago

jitaxis commented 2 years ago

Describe the bug I am trying to run the demo found on the GitHub page.

To Reproduce Run this block in the colab demo:

args.trained_model = "./weights/yolact_edge_54_800000.pth" args.yolact_transfer = True

torch.set_default_tensor_type('torch.cuda.FloatTensor')

logger.info('Loading model...') net = Yolact(training=False) net.load_weights(args.trained_model, args=args) net.eval() logger.info('Model loaded.')

net.detect.use_fast_nms = args.fast_nms cfg.mask_proto_debug = args.mask_proto_debug

args.score_threshold = 0.15 args.top_k = 15

Expected behaviour To work.

Full logs [04/06 21:28:17 yolact.eval]: Loading model...

UnpicklingError Traceback (most recent call last) in () 6 logger.info('Loading model...') 7 net = Yolact(training=False) ----> 8 net.load_weights(args.trained_model, args=args) 9 net.eval() 10 logger.info('Model loaded.')

2 frames /usr/local/lib/python3.7/dist-packages/torch/serialization.py in _legacy_load(f, map_location, pickle_module, pickle_load_args) 775 "functionality.") 776 --> 777 magic_number = pickle_module.load(f, pickle_load_args) 778 if magic_number != MAGIC_NUMBER: 779 raise RuntimeError("Invalid magic number; corrupt file?")

UnpicklingError: invalid load key, '<'.

Environment: Google Colab demo

Additional context I'm trying to get an understanding of the detection package and see if it fits my task.

nieknaber commented 2 years ago

I experienced the same issue. I have found that the download method with the download_google_drive repository corrupts the model file.

To fix this you can manually download the model file from drive here. You should upload this file manually in the demo colab to folder yolact_edge/weights/.

Your colab should now be able to use the model file properly.