Comments (10)
I know I'm a bit late, but I've managed to convert the model to tensorflow ;) Hope it's useful for the one's having problems with the conversion process.
Check out the code and documentation at tensorflow-open_nsfw if you're interested.
from open_nsfw.
The Scale layer in Caffe is implemented in Batch Normalization layer in Torch. BN layer in Torch nn library has four parameters: weight, bias, running_mean and running_var, the weight and bias here are the factor and bias in Caffe Scale layer. So you could convert this model to Torch. Probably other platforms as well.
If you plan to convert this from Caffe to Torch, here are two things you might want to know:
In Caffe BN layer, there's a scale factor stored in eg. nsfw_net.params['bn_1'][2].data. You need to divide this factor from all mean and var before you copy these parameters to Torch BN layer.
The pooling layer default setting in Torch is different to Caffe. Mainly about padding, when the padding is not set up, the default value is 0 in both Torch and Caffe, but if the ( inputSize - kernelSize + 2 * padding) / stride is not an integer, in Torch the default setting is floor()(means no padding) while in Caffe it's ceil()(add one side padding each rather than two). A simple way to replicate this layer in Torch is nn.SpatialMaxPooling(kernelSize, kernelSize, stride, stride):ceil()
ref: https://netaz.blogspot.co.uk/2016/08/confused-about-caffes-pooling-layer.html?
Hope this is helpful.
from open_nsfw.
WoW.......
from open_nsfw.
Why did they only release the ResNet model and not the Googlenet model?
from open_nsfw.
It works in TensorFlow converted with this tool.
from open_nsfw.
No, the tool cannot convert it, exits with ValueError.
from open_nsfw.
I used pycaffe to run the model successfully. However, used the cv::dnn (DNN module of opencv for loading caffe model) was failed. Is it because of the ResNet structure?
from open_nsfw.
@zzzcpan install pycaffe first, ValueError is gone afterwards.
from open_nsfw.
@mdietrichstein Using this Tensorflowcode here: https://github.com/ProGamerGov/Protobuf-Dreamer, I was able to find DeepDream layer and channel combinations which produced hallucinations entirely comprised of specific categories: https://github.com/ProGamerGov/Protobuf-Dreamer/wiki/Interesting-Layers-And-Channels
It would be interesting to use the DeepDream "layer + channel" technique to see what exactly each category of the open_nsfw
was. My experience with Tensorflow is very limited, as I mostly use Caffe and Torch7 at the moment.
I have previously experimented using the open_nsfw model and DeepDream without specifying specific channels, and found the results to create vague hallucinations of which the content was difficult to discern:
https://imgur.com/a/NtFyx, https://imgur.com/a/h3Lgn. The DeepDream images were made with this modified prototxt, and this style transfer/DeepDream project: https://github.com/crowsonkb/style_transfer
from open_nsfw.
@logic1988 I'm not sure what version of OpenCV you used but I'm using this model successfully with OpenCV DNN 3.3.1. You can see the use here.
from open_nsfw.
Related Issues (20)
- python can't open classify_nsfw.py HOT 2
- Instructions to retrain the model with own image data set HOT 1
- there is a RuntimeError: Pickling of "caffe._caffe.Net" instances is not enabled (http://www.boost.org/libs/python/doc/v2/pickle.html) when I try run open_nsfw in multi-process HOT 4
- Some images marked as nsfw are wrong HOT 4
- Build error HOT 3
- cannot upload docker file HOT 2
- Segmentation fault when running classify_nsfw.py
- if or not we need to delete the weight_filter{} and bias_filter in the deploy.prototxt? HOT 3
- Docker Build failure: the url given returns 404 HOT 3
- Dataset production
- google.protobuf.internal : ModuleNotFoundError: No module named 'google'
- Give me some data for training :trollface:
- Python3 Support HOT 8
- My NSFW model
- Would anyone like to maintain this project? HOT 1
- Building docker image fails HOT 4
- ImportError: cannot import name main HOT 3
- not preloading model when started from node with child process HOT 1
- performance cpu vs gpu HOT 1
- Detached head during image building
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from open_nsfw.