question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot eval on COCO test-dev on Google Colab

See original GitHub issue

I am trying to use YOLACT++ from Google Colab. Inference on images/videos works fine, but I can’t evaluate on COCO test-dev. I run this command: python eval.py --trained_model=weights/yolact_plus_resnet50_54_800000.pth --dataset=coco2017_testdev_dataset And I get:

Traceback (most recent call last):
 File "eval.py", line 1105, in <module>
  evaluate(net, dataset)
 File "eval.py", line 936, in evaluate
  img, gt, gt_masks, h, w, num_crowd = dataset.pull_item(image_idx)
 File "/content/yolact/data/coco.py", line 172, in pull_item
  if target.shape[0] == 0:
AttributeError: 'NoneType' object has no attribute 'shape'

If I change line 172 in coco.py to check if target is None I get another error:

Traceback (most recent call last):
  File "eval.py", line 1105, in <module>
    evaluate(net, dataset)
  File "eval.py", line 956, in evaluate
    prep_metrics(ap_data, preds, img, gt, gt_masks, h, w, num_crowd, dataset.ids[image_idx], detections)
  File "eval.py", line 390, in prep_metrics
    gt_boxes = torch.Tensor(gt[:, :4])
TypeError: 'NoneType' object is not subscriptable

I can get past this error by adding the argument --output_coco_json, but I don’t think it’s the right way to use the script. I think it’s a bug but could also be a Colab related issue (or some error of mine).

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
dbolyacommented, Mar 12, 2020

You can use --score_threshold=0.05 to reduce the file size. As for the first bug, that’s an oversight on my part. For now you can comment it out. I’ll try to get a fix out today.

0reactions
ShihuaHuang95commented, Aug 11, 2020

i got the same error, how to solves?

Comment these lines: https://github.com/dbolya/yolact/blob/092554ad707c2749631dfe545c8a953b2b3f4a68/data/coco.py#L172-L174

and use --output_coco_json flag.

For me, I add another condition based on the previous one as below: “if target.shape[0] == 0 and self.has_gt:”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Importing COCO datasets to google colaboratory
It's around 20GB including the train, test and validation datasets. I want to directly import the dataset from cocodasets.org to my Google colab...
Read more >
notebook04660a88f4 | Kaggle
We used two tools to annotate the images: labelimg for labeling the classification dataset and coco-annotator for labelling the keypoint dataset. link code....
Read more >
Custom object detection in the browser using TensorFlow.js
Train a custom MobileNetV2 using the TensorFlow 2 Object Detection API and Google Colab for object detection, convert the model to ...
Read more >
Train An Object Detection Model using Tensorflow on Colab
Google Colab is used for training on a free GPU. ... new pre-trained weights for COCO (a common dataset to test object detection...
Read more >
Object detection with YOLO - Medium
... get mAP, average loss statistics in Google Colab and test trained ... For example if to train model on dataset with all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found