bhky / opennsfw2

Keras implementation of the Yahoo Open-NSFW model
MIT License
361 stars 47 forks source link

Huge video memory footprint #20

Closed MisakaMikoto-o closed 11 months ago

MisakaMikoto-o commented 11 months ago

My python version is 3.8, cuda version is 10.2.

MisakaMikoto-o commented 11 months ago

I have sovled it with upgrading my cuda version to 11.4

MisakaMikoto-o commented 11 months ago

but the model is so large that it takes up almost all of my 16 gigabytes of video memory, while the h5 model file is just 23MB

MisakaMikoto-o commented 11 months ago

any way to reduce the model size?(T ^ T)

bhky commented 11 months ago

Hello! Thanks for your interest in the library! I'm glad that you have figured out the CUDA issue. :+1:

On the model size..... I'm sorry that I also don't have a solution for it.

For the model object itself, you may try to convert it to a TF Lite object as described here, but I have never tried it. :thinking:

Also, this is only for the model object, so you probably need some fiddling with the preprocessing steps on your own as shown here.