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

Releasing Other Models? #11

Closed
sbodenstein opened this issue Oct 6, 2016 · 10 comments
Closed

Releasing Other Models? #11

sbodenstein opened this issue Oct 6, 2016 · 10 comments

Comments

@sbodenstein
Copy link

First of all, thanks for the release! Second: its a pity that the released model (Resnet) has a highly non-standard layer ("Scale", which has a learnable bias parameter). That means that this model cannot be converted to other frameworks (Torch, MXNet, etc).

Would it be possible to release one of your other models as well, such as the Googlenet model?

Thanks!

@nemosail
Copy link

WoW.......

@ProGamerGov
Copy link

Why did they only release the ResNet model and not the Googlenet model?

@jarutis
Copy link

jarutis commented Oct 19, 2016

It works in TensorFlow converted with this tool.

@zzzcpan
Copy link

zzzcpan commented Oct 21, 2016

No, the tool cannot convert it, exits with ValueError.

@logic1988
Copy link

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?

@jarutis
Copy link

jarutis commented Oct 24, 2016

@zzzcpan install pycaffe first, ValueError is gone afterwards.

@XuefeiW
Copy link

XuefeiW commented Oct 25, 2016

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.

@mdietrichstein
Copy link

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.

@ProGamerGov
Copy link

ProGamerGov commented Jun 1, 2017

@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

@TechnikEmpire
Copy link

@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.

@gyehuda gyehuda closed this as completed Jan 8, 2018
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

10 participants