Tiny-Mud6713
Tiny-Mud6713 OP t1_iwcngla wrote
Reply to comment by Technical-Owl-6919 in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
So I import the model and unfreeze it immediately and just add my top layers ?
Tiny-Mud6713 OP t1_iwcleya wrote
Reply to comment by Technical-Owl-6919 in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
They're pictures of some plant, 8 classes for 8 different species of the same type of the plant.
Tiny-Mud6713 OP t1_iwck8e1 wrote
Reply to comment by Technical-Owl-6919 in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
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
Tiny-Mud6713 OP t1_iwcjsgx wrote
Reply to comment by shot_a_man_in_reno in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
Oh no, from the comments i realized that I have explained things in a bad way, I train the FC layer until it early stops while the DenseNet is frozen, then I take that model and retrain the weights with unfreezing 200-ish layers and lowering the learning rate
Tiny-Mud6713 OP t1_iwcjcrv wrote
Reply to comment by Technical-Owl-6919 in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
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_iwcgyg7 wrote
Reply to comment by czhu12 in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
Hahhaha, definitely! The pictures are of leaves of 8 different species and they're square 96-pixel images, so not so great to visually look at
Tiny-Mud6713 OP t1_iwcgqff wrote
Reply to comment by Ragdoll_X_Furry in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
Actually the resizing really boosted the performance by like 5%, I'm at at 80% now, but still looking to boost it up
Tiny-Mud6713 OP t1_iwcglrg wrote
Reply to comment by Ragdoll_X_Furry in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
1- I'm doing a 20% split, so in total they're around 2800, 700 training and validation.
2- batches of 8, Adam with LR=0.001 in the transfer part, LR=0.0001 in the fine tuning, any other combination caused everything to crumble.
3- currently 0.3, 0.5 caused some early stopping problems, since the model was stuck
4- valid_data_gen = ImageDataGenerator(rescale=1/255.)
train_data_gen = ImageDataGenerator(
rescale=1/255.,
rotation_range = 30,
width_shift_range = 0.2,
height_shift_range = 0.2,
horizontal_flip = True,
vertical_flip = True
)
​
and then flow from file to get the preprocessed images
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
Tiny-Mud6713 OP t1_iwc919l wrote
Reply to comment by Nhabls in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
7 classes are equally distributed (500 images), only 1 has like 25% of the other data share (150-ish), it is a problem but I'm not sure how to solve it considering the fact that it's a challenge and I can't add data, augmentation will keep the imbalance since it augments everything equally.
Tiny-Mud6713 OP t1_iwc7y2g wrote
Reply to comment by RoaRene317 in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
Very insightful, Haven't tried most of these things, thanks for sharing the knowledge.
Tiny-Mud6713 OP t1_iwc219b wrote
Reply to comment by FakeOuter in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
Will try that thanks
Tiny-Mud6713 OP t1_iwc207i wrote
Reply to comment by sbduke10 in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
It's a challenge the test is online on unseen data, and I'm shuffling the split data each run
Tiny-Mud6713 OP t1_iwc1vq9 wrote
Reply to comment by ItalianPizza91 in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
Yeah the problem is that this is a challenge and the data is limited, tried data augmentation but haven't had much luck.
However, I must ask, when using data augmentation is it better to augment the training and the validation sets or just the training?, seen conflicted opinions online.
Tiny-Mud6713 OP t1_iwbkf15 wrote
Reply to comment by Intelligent-Aioli-43 in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
Never worked with lightning, may sound dumb but, how does changing the library change the output of the learning process?
Tiny-Mud6713 OP t1_iwbjjp1 wrote
Reply to comment by ok531441 in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
Yes that's the first step I do, after that step I try to unfreeze and fine tune
Tiny-Mud6713 OP t1_iwbje65 wrote
Reply to comment by Intelligent-Aioli-43 in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
The library?
Tiny-Mud6713 OP t1_iwbibsp wrote
Reply to comment by The-Last-Lion-Turtle in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
The DenseNet201(functional) layer is the full CNN but it's collapsed because it's>700 layer, will try those, thank you
Tiny-Mud6713 OP t1_iwbhh7f wrote
Reply to comment by ok531441 in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
I have been trying all of the Keras API transfer models but no luck, any suggestions on a newer model, I know the models will behave according to the problem but I'm ready to test anything rn, also any tips on the FC architecture?
Submitted by Tiny-Mud6713 t3_yuxamo in MachineLearning
Tiny-Mud6713 OP t1_iwd0cqz wrote
Reply to comment by Ragdoll_X_Furry in [P] Need help with this CNN transfer learning problem by Tiny-Mud6713
I haven't tried playing with the optimizer, thank you for the notice, also thanks for the code, will try to play around with it too :)