Skip to content

Conversation

@pcuenca
Copy link

@pcuenca pcuenca commented Oct 1, 2018

Main tasks include:

  • Proof of concept implementation.
  • Reuse JdeRobot labels instead of having duplicate metadata files.
  • Remove hardcoded assumption of Coco categories.
  • Error handling: dynamic library or model files cannot be found.

The current version works, but it assumes Coco labels and loads a separate metadata file with Coco categories taken from the Darknet distribution. I'll be updating this PR as I work on the improvement tasks above.

To test YOLOv3-tiny, please follow these steps:

  1. Download and compile Darknet to obtain libdarknet.so.
  2. Copy yolov3-tiny.cfg from the Darknet distribution into Net/Darknet.
  3. Download yolov3-tiny.weights and place it into Net/Darknet.
  4. Update your DYLD_LIBRARY_PATH to include the directory where libdarknet.so resides.
  5. Run the object detector as usual, using the yml configuration file supplied in this PR.

Other models are possible. The corresponding darknet weights and configuration files must be placed in the Net/Darknet directory. They must have the same name (except for the extension), which must in turn match the Model name defined in the YAML configuration file.

Credits

  • All data files have been taken from the Darknet distribution.
  • The darknet.py file was also copied from the Darknet distribution, but it includes modifications to trigger detection from a numpy image instead of a file.

Not intended for general use. Please, keep in mind the following important known issues:
- Detections are still extremely slow. The main reason is that the image supplied to Darknet is created by iterating through the Python numpy array.
- Labels are assumed to be Coco.
- Labels are read from data files copied from the Darknet distribution, and then supplied to the darknet library. However, the GUI still uses the same data files used throughout the project. We should reuse those files instead of keeping separate copies.
- Some hardcoded paths and values.

To test YOLOv3-tiny, please follow these steps:

0. Download and compile Darknet to obtain libdarknet.so.
1. Copy yolov3-tiny.cfg from the Darknet distribution into Net/Darknet.
2. Download yolov3-tiny.weights and place it into Net/Darknet.
3. Update your DYLD_LIBRARY_PATH to include the directory where libdarknet.so resides.
4. Run the objectdector as usual, using the yml configuration file in this revision.

Other models are possible. The corresponding darknet weights and configuration files must be placed in the Net/Darknet directory. They must have the same name (except for the extension), which must in turn match the Model name defined in the YAML configuration file.

I plan to work on speed next. As mentioned above, libdarknet requires an image structure that is manually built from a Python numpy array. I tried to supply a pointer to the underlying Python array instead, but I didn't know how to make it work using ctypes. I'm concerned that the byte ordering will differ anyway. It would be trivial to create a public helper function in libdarknet, but I don't want to depend on patched versions of Darknet.

Credits
- All data files have been taken from the Darknet distribution.
- The darknet.py file was copied from the Darknet distribution, but it includes modifications to trigger detection from a numpy image instead  of a file.

Part of JdeRobot#38
… of iterating.

Speed is much faster, as expected.

Part of JdeRobot#38
@pcuenca pcuenca mentioned this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant