Submitted by Tiny-Mud6713 t3_yuxamo in MachineLearning
Tiny-Mud6713 OP t1_iwcfxo2 wrote
Reply to comment by Technical-Owl-6919 in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
I have tried that at first since it was intuitive and a benchmark since it's less parameters, but two layers gave better results, also the GAP has caused the training to early stop very early on, what do you suggest to as the top layer, eg GAP, batchnorm, dense
Technical-Owl-6919 t1_iwch8sv wrote
See, from my experience I would ask you to use EfficientNets in the first place. Secondly please don't unfreeze the model at the very beginning. Train the frozen model with your custom head for a few epochs and when the loss saturates, reduce the Lr and unfreeze the entire network and train again. Btw did you try LR Scheduling ?
Tiny-Mud6713 OP t1_iwcjcrv wrote
In the post I said I unfroze the CNN layers, I meant after the transfer learning part. I run it untill it early stops with all CNN layers frozen, then run it with unfreezing the top 200 layers or so.
I'm obliged to work on Keras K don't know if it has an LR sched method, I'll check the API great advice.
Tiny-Mud6713 OP t1_iwck8e1 wrote
The problem with efficient nets is that I ran a test on some models apriori, I got this graph, note that the dataset was ran for 3 epochs only each model.
https://drive.google.com/file/d/1OyXaWg6vMirYeI9zLSeGJ2v_qCz3msu4/view?usp=share_link
Technical-Owl-6919 t1_iwckvp7 wrote
Something seems to be wrong, the validation scores should not be so low. Exactly what type of data are you dealing with ?
Tiny-Mud6713 OP t1_iwcleya wrote
They're pictures of some plant, 8 classes for 8 different species of the same type of the plant.
Technical-Owl-6919 t1_iwclyq8 wrote
So my friend, then you have to train the network from scratch, it is getting trapped into a local minima. Maybe a small network might help. Try training a ResNet15 or something similar from scratch. This has happened with me once, I was working with Simulation Images and could not get the AuC score to go above 0.92, once I trained it from scratch I got AUC scores close to 0.99, 0.98 etc.
Tiny-Mud6713 OP t1_iwcngla wrote
So I import the model and unfreeze it immediately and just add my top layers ?
Technical-Owl-6919 t1_iwco8xr wrote
Yes and train them, everything is unfrozen.
arg_max t1_iwcn3y0 wrote
Imagenet 1k pretraining might not be the best for this as it contains few plant classes. The bigger in-21k has a much larger selection of plants and might be better suited for you. Timm has efficient net v2, beit, vit and convnext models pretrained on this though I don't use keras you might be able to find them for this framework.
Viewing a single comment thread. View all comments