davamix/cats-localization

No Class training

Closed this issue · 5 comments

@davamix
My goal is to create a model that can run fast on CPU and is light on ram, along with being accurate.

  • I tested training on rpn_R_50_C4_1x since it is very fast and only uses 1.5GB ram noted.
  • Before training, I changed train.py and test.py to COCO-Detection/rpn_R_50_C4_1x.yaml
  • Note that I trained on the cat dataset that you provided.
    Also here is my trained model

Once the model was trained, I ran test.py but I am getting an error:

(d2) home@home-desktop:~/p13/c2$ python ./src/test.py 
Traceback (most recent call last):
  File "./src/test.py", line 106, in <module>
    test_image(image_path)
  File "./src/test.py", line 38, in test_image
    pred_classes = (outputs.pred_classes).detach()
AttributeError: 'dict' object has no attribute 'pred_classes'

outputs is a dictionary, so to access to the pred_classes is through outputs['instances'].pred_classes

But what about when wanting to predict using rpn_R_50_C4_1x it's a COCO-Detection model not a COCO-InstanceSegmentation model, so classes are not required, that why it shows the error.

Sorry, I misread the type of the model.

Looking the documentation, the predictor always returns a dictionary, but depending of the model, the values inside the dictionary are diferent. Check the the Model Output Format.

So, instead of outputs['instances'].pred_classes you can use outputs['proposals'].proposal_boxes

Also, you can print(outputs) and see what values are inside and how they are named.

hmmmm... I was not able to create a working script.
Have a look at my rpn cats trained model
Upload the changed files so i can test.

Check this gist.

In test.py I use COCO-Detection/rpn_R_50_C4_1x.yaml configuration with your trained model, then I printed some values from outputs.