Skip to content
This repository has been archived by the owner on Oct 18, 2019. It is now read-only.

performances issues #56

Open
puckpuck85 opened this issue Jul 2, 2017 · 12 comments
Open

performances issues #56

puckpuck85 opened this issue Jul 2, 2017 · 12 comments

Comments

@puckpuck85
Copy link

the classify script does take 1 sec. on avg. to classify one picture.

any ideas to tuning performance? moving model + caffe into ram drive?

@TechnikEmpire
Copy link

Switch to using the model via OpenCV's DNN module, it's pretty quick. On my desktop I can classify at about 34 FPS.

@danielbicho
Copy link

Hey @TechnikEmpire can you give a brief description of your desktop specs? thx!

@TechnikEmpire
Copy link

TechnikEmpire commented Jan 8, 2018

@danielbicho i7 6700 @ 3.4 ghz w/16gb ram.

Don't worry, I've trained a squeezenet model that has similar accuracy but is ~3x faster. Yahoo didn't open source their solver/training params trying to keep the secret sauce secret.

Relevant stuff here:
https://github.com/TechnikEmpire/NsfwNET
https://github.com/TechnikEmpire/NsfwSqueezenet

There's a pure C++ example in the NsfwNET repo as well so it's not just C#. It's just a C# wrapper around C++/openCV.

@danielbicho
Copy link

Impressive work @TechnikEmpire . I will definitly test your NsfwSequeezenet, but first i need to label my own dataset for validation. I have like Terabytes of images to classify so speed is important to be able to do it in a reasonable time frame!

Basically even if i use Yahoo model with OpenCV's DNN module i will get increased speed performance??

@GuiFri
Copy link

GuiFri commented Jan 8, 2018

@TechnikEmpire, are all caffe models fastervia OpenCV's DNN module?

@TechnikEmpire
Copy link

@danielbicho yes, the DNN module is several times faster it would appear than using python here. As you see above people report on average a whole second (life age of the universe in computer time) to get a single forward pass and returned result.

If you need to classify that much data though, do what I did. Get a half decent nvidia GPU, install Ubuntu 17+, install caffe-cuda and then use the c++ classifier example in the caffe repo to do your classification on the GPU. If you have TB of data you're going to want to do that or massively parallelize CPU classification, which will involve creating per-thread classifier instances because the network operations are not thread safe.

If I can offer any other help just drop me an email, contact info should be in my profile I think or just send to info @ my name .com.

@TechnikEmpire
Copy link

@GuiFri They are constantly updating a thorough benchmark table here:

https://github.com/opencv/opencv/wiki/DNN-Efficiency

For the work involved to get OpenCV DNN up and running with a CPU target, speed, and for the smallest binary size, cv::dnn is the best afaik.

@TechnikEmpire
Copy link

@danielbicho If you do go the GPU route then just use Yahoo's model here. It is a very good model, it's just expensive to run. I made my squeezenet model because I need to deploy something like this for mass market in consumer software so I'm ok with not having quite the same amount of coverage as Yahoo's excellent model.

@GuiFri
Copy link

GuiFri commented Jan 9, 2018

@TechnikEmpire Regarding GPU route, what do you expect it would be faster:
1- NsfwNET with dual Xeon E5-2667v4 8xCores 3,20 Ghz
2- open_nsfw with Ubuntu 17+ and caffe-cuda with an nvidia GTX1080 8G

@wangsijie
Copy link

@TechnikEmpire I use your "nsfw_squeezenet.caffemodel" to classify 40 pictures and it takes 15s, but it just takes 6s using Yahoo's model provided in this repository.

PS. CPU mode, i7-7700k

@TechnikEmpire
Copy link

@wangsijie @GuiFri you guys should create tickets on my repo as I don't want to cause chatter on Yahoo's repo over my stuff. I'd be interested to know how you're executing these classifications @wangsijie as those stats are brutally bad. You're using CV::dnn for this?

@yunhai0920
Copy link

@TechnikEmpire hi, I use your "nsfw_squeezenet.caffemodel" &"deploy.prototxt" and Yahoo's classify_nsfw.py to classify 1picture,it takes 0.38s, but it takes 0.53s using Yahoo's model .

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

No branches or pull requests

6 participants