Open puckpuck85 opened 7 years ago
Switch to using the model via OpenCV's DNN module, it's pretty quick. On my desktop I can classify at about 34 FPS.
Hey @TechnikEmpire can you give a brief description of your desktop specs? thx!
@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.
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??
@TechnikEmpire, are all caffe models fastervia OpenCV's DNN module?
@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.
@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.
@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.
@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
@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
@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?
@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 .
the classify script does take 1 sec. on avg. to classify one picture.
any ideas to tuning performance? moving model + caffe into ram drive?