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

Compiling model #342

Open
creativenoobie opened this issue May 16, 2020 · 3 comments
Open

Compiling model #342

creativenoobie opened this issue May 16, 2020 · 3 comments
Labels
question Further information is requested

Comments

@creativenoobie
Copy link

Hey,

Thank you for all the efforts on this library.

So I downloaded the models from https://github.com/GantMan/nsfw_model/releases/tag/1.1.0 and was able to use them with nsfwjs using graph option.

I just wanted to know how can I compile these models from graph to image (299x299)? I know I can just download from your S3 bucket but I don't want to increase your network costs since I will be deploying the same to cluster of servers so I was looking for an optimum solution that could help me.

Also, I just noticed that you've deployed a new model (mobilenetMid) with similar accuracy but decreased size, any tips on how to compile new model for backend (nodejs) use?

@GantMan
Copy link
Member

GantMan commented May 17, 2020

Hi! I'm not sure I understand the question.

I just wanted to know how can I compile these models from graph to image (299x299)? I know I can just download from your S3 bucket but I don't want to increase your network costs since I will be deploying the same to cluster of servers so I was looking for an optimum solution that could help me.

Can you elaborate?

@GantMan GantMan added the question Further information is requested label May 17, 2020
@creativenoobie
Copy link
Author

Basically, I am using nsfwjs with type: graph:
nsfwjs.load('/path/to/different/model/', { type: 'graph' })

This process takes upto 150MB/worker in my nodejs application which is a lot tbh.

I just want to know how can I load model using size: 299x299 option. I am hoping that this will significantly reduce the memory usage.
I do understand that size option won't work with https://github.com/GantMan/nsfw_model/releases/tag/1.1.0 models directly and I might need to convert these models before making it work so I just wanted to know how can I convert these models from graph to image?

@GantMan
Copy link
Member

GantMan commented May 28, 2020

The size option depends on the model you load. You won't be able to use the graph with 299, because it was trained on 224 data.

That is a lot of space. I wonder what's really taking up that process space. Have you experimented on loading smaller models?

You can create a 48kb model using this page I made: https://rps-tfjs.netlify.com/
I'd be interested in seeing the process memory for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants