GantMan / nsfw_model

Keras model of NSFW detector
Other
1.8k stars 279 forks source link

For tf2 version, why using the model from Tensorflow Hub directly? #86

Closed isunix closed 3 years ago

isunix commented 3 years ago

@TechnikEmpire

For the tf2 version of the training, you said "Scripts that train all current models from Tensorflow Hub modules using transfer learning." My question is: Why you use the model from Tensorflow Hub to start your training? Why not use the previous best model to do your transfer learning ?

TechnikEmpire commented 3 years ago

Because the hub modules are trained on imagenet, and thus the theory (which holds true in my experience) is that those models have already very well developed features and simply need to be fine tuned to your specific domain.

However, the training scripts for tf2 will actually load previously saved weights when you pass the fine tune parameter (iirc) so it's possible to keep refining models once you generate one. However, we always start initially from a hub module for the reasons given above.

I've actually manually, from scratch, trained mobilenet v2 and v3 models against NSFW problem and the models created from hub modules always beat the from the scratch versions. This is again because the hub modules have learned much better generalized features to tackle the 1000 class problem they were originally built against.

Hopefully I've answered your question correctly.

isunix commented 3 years ago

@TechnikEmpire

Yes , I believe transfer learning works here. I just have questions as to transfer from which model? The Tensorflow Hub one or the one you just have trained. Why not start from the one you previously trained do the transfer learning from that good starting point.

TechnikEmpire commented 3 years ago

You definitely could for sure but the idea of the scripts is to help people train from nothing.

isunix commented 3 years ago

@TechnikEmpire Ok, thanks