Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yolo #165

Closed
moz4r opened this issue Feb 28, 2018 · 17 comments
Closed

Yolo #165

moz4r opened this issue Feb 28, 2018 · 17 comments
Assignees

Comments

@moz4r
Copy link
Contributor

moz4r commented Feb 28, 2018

Place for yolo gurus to talk about integration Inside mrl !

What I understood

  • Need to publish data
  • Need linux support
  • Need to call yolo from runtime instead of a .bat
  • Need a filter for opencv
  • Need code somewhere on github!

What else ?

@bretzel59
Copy link

For Linux support I think we only need to add the Linux build and the required libraries.

@supertick
Copy link
Contributor

Ahoy !
It looks like as kwatters has mentioned that Yolo is supported in OpenCV,
I'm sure JavaCV is currently or shortly will be updated to support this as well ..

Here's the first link I found searching for OpenCV & Yolo - https://docs.opencv.org/3.4.0/da/d9d/tutorial_dnn_yolo.html

If we can add this as a filter to our OpenCV service, potentially it will solve all 5 line items by moz4r

@moz4r
Copy link
Contributor Author

moz4r commented Feb 28, 2018

5 lines saved * x code lines , great ! that will be a filter that rock.
I think bretzel59 is afraid about performances and want to use the gpu for compute.

@kwatters
Copy link
Contributor

heh. i feel honored.
so.. javacv 1.4 (which includes OpenCV 3.4) still has some dependency issues in maven central. (missing dependencies for ffmpeg and other transient dependencies.)
In theory similar support existed in OpenCV 3.3.1 .. I'll see what I can find.

@bretzel59
Copy link

Does yolo in JavaCV be CUDA Ready ? In my opinion, the support of Cuda is mandatory. (it seems to be but could you confirm that)

Will it be possible to publish data like :

  • Name of detected objects
  • Window coordinates (x-y) in the picture
  • Numbers of identical objects in order to enumerate them

Will it be possible to use yolo 9000 model or any homemade pre-trained model ? Can I use my own file.names to inclued French or English translation ?

Could I switch pre-trained model on the fly ?

Hehe a lot of questions :D

@kwatters
Copy link
Contributor

kwatters commented Mar 2, 2018

Mrl is upgraded to javacv 1.4. a Yolo filter has been added to OpenCV. You will need to have the yolo.cfg, yolo.weights and the coco.names files downloaded manually now for it to work.

I took a similar approach to the dl4j filter so the frame rate isn't affected by adding the Yolo filter.

@ghost
Copy link

ghost commented Mar 2, 2018 via email

@bretzel59
Copy link

Hi Juerg,

I'm already using cuda with darknet Under Windows, I've compiled a port made by Alexey. https://github.com/AlexeyAB/darknet The question is if it's possible tu use CUDA under JAVACV 1.4 in MRL.

I've already using yolo with MRL by a "yolo service" programmed by Dom14, The idea was to launch a single pic detection on demand. I can use any weigth files and switch on the by switching between 3 batch files (vos, coco 9000). Loading weigth files like yolo 9000 takes less than 5 seconds on my robot, (I3 7300T with 16Go RAM, SSD and GTX 1060). Yes you can use cpu for single frame detection but my idea is to release CPU for other tasks (motion control).

I' m thinking like you about Yolo 9000, it seems less accurate but works for me.

@hairygael
Copy link
Contributor

hairygael commented Mar 2, 2018 via email

@moz4r
Copy link
Contributor Author

moz4r commented Mar 2, 2018

Will look forward to test last Yolo integration tks ! I just saw it : bytedeco/javacv#481
Kwatters you uptaded javaCv to 1.4 I assume we have now some kind of cuda support for people want to use it ?

@kwatters
Copy link
Contributor

kwatters commented Mar 2, 2018

I've update MRL to JavaCV 1.4. Also, I added a new opencvfilter for "Yolo". This uses the coco names (80 classes of objects recognized.). It finds things like person, chair, and tv monitor pretty well. I haven't tested extensively.
The new OpenCV filter for Yolo has some configuration options on them for the "darknetHome" (this is the directory where darknet is installed. (including the yolo.weights cfg/yolo.cfg and data/coco.names )
The filter samples images from the frame grabber as fast as it can, processes the image on a separate thread, and then updates the current frame with the bounding boxes. This approach means it does not slow down the frame rate when running it. (I was seeing 15 fps with or without the yolo filter running.)
I definitely still need to clean up the code a bit and provide some python examples for using it.. Also, when installing opencv it should know to download the yolo models files, so perhaps we should add those to the myrobotlab artifactory instance and define them as a proper dependency.

As far as I can tell, I'm almost 85% a person.
https://twitter.com/kwatters76/status/969335209698131968

@moz4r I'm not sure about cuda support.. it all depends on how it was compiled and I'm not sure how to verify that from javacv land.

@bretzel59
Copy link

bretzel59 commented Mar 2, 2018

Ok manage to get it worky !
yolo

GREAT ! 👯‍♂️

But seems it takes a lot of CPU Power (60% for my i7). As I thought, 22fps for opencv video Stream, but 1fps detection. Cuda Cuda Cuda :)

You can see GPU was working but I think it was just for opencv stream because GPU is working exactly the same without yolo filter (34%) and opencv without filters takes 4% of my i7

@bretzel59
Copy link

It seems to be not compatible with Yolo 9000, this is the warning when configuring Yolo 9000 in the YoloFilter : "OpenCV Error: The function/feature is not implemented (Yolo9000 is not implemented) "

@bretzel59
Copy link

bretzel59 commented Mar 2, 2018

Ok, below, confirmation about Yolo 9000 (maybe others ?) :

opencv9000

Not supported under Opencv 3.4 at this time (maybe later).

@kwatters
Copy link
Contributor

kwatters commented Mar 2, 2018

I just checked in changes that will automatically download and cache the models. Also a lot of other code cleanup. I think it's pretty good now for initial support.

Opencv should now publishYoloClassifications that you can subscribe to

@kwatters
Copy link
Contributor

we should deploy the model as a zip file dependency in the mrl repo. Once that's done and I test that it's all working , we'll close this issue.. as we will have some yolo support. we can always add more models later under a new issue

@kwatters
Copy link
Contributor

ok. now the latest will deploy the yolo models as part of the build. I still can't get it working on the raspi.. i think it's due to overheating or something.. the raspi becomes unresponsive when i try to start the yolo filter. otherwise, it seems to be working just fine on win x86 64 bit. I'd like to expose yolo via dl4j, however that's still work in progress and we can track that as a different issue.

closing ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants