I am working with a generated graph in the example given in the sdk, concretely in the video_objects example.
What I am facing now is that I want to remove some labels from the network, and keep only 4 of them.
What I have tried so far is:
Remove the labels from original code:
labels = ('background',
'aeroplane', 'bicycle', 'bird', 'boat',
'bottle', 'bus', 'car', 'cat', 'chair',
'cow', 'diningtable', 'dog', 'horse',
'motorbike', 'person', 'pottedplant',
'sheep', 'sofa', 'train', 'tvmonitor')
to my code:
labels = ('background', 'bicycle','bus', 'car','motorbike')
This throws the following exception, because it is still detecting me as a person, but the index of the class_id is out of range:
Traceback (most recent call last):
File "video_objects_fake_interesting_tags.py", line 569, in <module>
File "video_objects_fake_interesting_tags.py", line 523, in main
File "video_objects_fake_interesting_tags.py", line 224, in run_inference
overlay_on_image(image_to_classify, output[base_index:base_index + 7])
File "video_objects_fake_interesting_tags.py", line 102, in overlay_on_image
label_text = labels[int(class_id)] + " (" + str(percentage) + "%)"
IndexError: tuple index out of range
Then, I tried to recreate the graph. To do this, I used the example provided in the SDK, in the SSD_mobile. The steps I followed are:
Of course it fails because the num_output is not correct, but I don't know which one would be the correct, or if the procedure is the appropriate.
The exception that I got is:
F0903 10:01:59.411049 2634 detection_output_layer.cpp:166] Check failed: num_priors_ * num_classes_ == bottom->channels() (9585 vs. 40257) Number of priors must match number of confidence predictions.
Can anyone give me some guidance on how to modify the number of classes provided? This would be very helpful, since for example, a motorbike is often detected as a person, but I do not want to detect persons
In order to help anyone reading this, the next step that I will follow is to retrain a caffe SSD_Mobilenet with my classes. These classes are part of the VOC Dataset, so I will follow the following guide:
Note that this is a fork from the official caffe repository.
What I am trying to do now is to retrain for 5 classes:
So after I have my model trained, I will try to export as a NCS graph and run it on my original script. I will come back with the results.
In the meantime, if anyone reading this thinks there are other steps that make this process faster, please don't hesitate posting
Thanks in advance!