Hello, after working with various object detection networks on the Jetson platform, I decided to create one with an emphasis on being easy to train and running at high FPS with low memory, aimed at hobbyist and maker projects.
Meet Keras MobileDetectNet, a network with ~300K parameters which can run at 55 FPS on the Jetson Nano using TF-TRT. It is simple to train (often producing usable results in < 50 epochs) using KITTI label format just like nVidia DIGITS and includes robust online image augmentation. Even with a small dataset of 1-2K images it manages to perform well for a network with such a small amount of parameters, perfect for hobbyist projects which need object detection. This is partially thanks to its utilization of Faster R-CNNâs anchor system, which provides much more robust bounding box regression results.
Iâm trying to run your train.py --help script, but I got notified that I donât have some of the dependencies. Iâve installed plac via pip3.
After that, it gave me a ModuleNotFoundError for âimgaugâ. When I was trying to install imgaug through pip3, but it couldnât find Shapely. I installed geos through sudo apt-get install libgeos-dev, and then Shapely through pip3 install shapely, but when I hit pip3 install imgaug, it tells me that imgaug requires opencv-python.
imgaug is not needed for inference, only training. There is no need to install it on the Jetson. Assuming your training system is x86_64, it should install flawlessly via pip3.
File "/home/angelo/keras-mobile-detectnet/generator.py", line 99, in __getitem__
old_shape = image.shape
AttributeError: 'NoneType' object has no attribute 'shape'
Usually this indicates an issue with the path to images. Could also be a non image file present in the directory (like thumbs.db or .DS_Store for instance)
That line isnât in generator.py in the current master branch as best I can tell (last updated July 13th 2019).
Would you mind posting the full stack trace?
It looks like something that may have been in a previous version however. I would recommend doing a git pull if that is the case, or if you made changes to stash them using git stash and then use git pull to update your copy.
Youâre right, sorry. I was about to open another issue ticket on your github, then I saw the questionable line of code.
I think itâs training now and itâs processing the bounding boxes at line 113. May I get a ballpark figure on how long this process is gonna take?
EDIT:
You guys might have to modify generate.py. In my use case scenario, my label files were being parsed with an extra blank line in load_kitti_labelâs split method
In the for loop, insert the following:
for row in label.split('\n'):
fields = row.split(' ')
++fields_length = len(fields)
++if fields_length == 1:
++++continue
This will make sure that the blank whitespaces WONâT be processed and parsed! Otherwise, youâll get an Index Out of Bounds Error in:
Good catch! The easiest fix is just calling .strip() before splitting the lines. I committed this to the master branch. I will also looking into dealing with hidden files better.
I am working on putting together an example using it in realtime with OpenCV for a demo on Friday. Will post an update when the code is complete. But if you are interested, I have a working motion detection script with realtime display available here that could be used as a reference: https://github.com/ieee-uh-makers/pi-workshop/blob/master/python/lesson2_motion.py
Please do. Iâm able to edit the existing inference.py code to take webcam video input for inference (Iâm Zeit42 on github), but it doesnât work.
What I tried doing was saving the webcam input as jpeg images in a folder, and then running the original inference.py code on that folder. I was able to get results on the images in the folder, but not in my realtime object detection.
Hi Angelo, here is a notebook which allows you to visualize everything in realtime from a camera:
Right now it just uses Tensorflow for inference, but it wouldnât be difficult to adapt it to use TF-TRT for optimization (see inference.py for an example of this)
Hi vancecs, I ran the train.py. It got no errors but the program stuck at the âEpoch 1/10â.
I modified the batch_size=1, epochs=10. And the path direct to the folder include the images and labels floder.
What eles should I do? Thanks a lot.