Hi!
I’m trying to do it by myself. Modifying the VGG16 component. I’m slow because I’m just a beginner.
By now it doesn’t work
Thanks!
Hi!
I’m trying to do it by myself. Modifying the VGG16 component. I’m slow because I’m just a beginner.
By now it doesn’t work
Thanks!
Hi Clarilla
Nice to see another new face - hope you find what you want here: we’re all beginners at something
I’m curious about your VGG16 modifications because it’s a pre-trained component. What are you planning to do to it/with it?
By now it doesn’t work
Feel free to ask for input when you feel like it - if something isn’t working right or you don’t know how to get the best from PL itself on of the PL guys will help out; if it’s ML in general there are others around who might be able to help - depending on what you are trying to do
Keep us in the loop - we’re all keen to learn new tricks and to benefit from new ideas & ways of doing things!
Hi!
Yes, VGG16 is a pretrained model. What I want to do is to retrain the last labels of the model with my data.
The model is trained with some group of images. As I understand, the first layers learn basic shapes, colors and the lasts layers can identify objects. So if my images are different from the images that trained the VGG16, maybe it won’t be a good model for my.
So the Fine-tunning refers to retrain the last labels with my data.
It’s supposed that it can be done. I have done it with code copied from a book. I wanted to try it here whith PL.
In the VGG16 component, where it says:
self.vgg16.trainable = False
I changed for:
self.vgg16.trainable = True
set_trainable=False
for layer in self.vgg16.layers:
if layer.name=='block5_conv1':
set_trainable=True
if set_trainable:
layer.trainalbe=True
else:
layer.trainable=False
I’m not skilled using classes and I don’t see all the code. It is supposed that I am specifying not to train the first labels, and train labels from the one whose name is ‘block5_conv1’. But I’m not sure if I have done it where it has to be done, or if I should modify more things.
I will try again with something more easy, but my target is to do this retraiment of the last labels of the model.
Thanks for your answer!
PS: PerceptiLabs for me looks really cool
Hi Clarilla
I’ll tag @robertl for confirmation but I I think you can use the VGG16 component as it is: it is provided trained so that you benefit from pre-training, i.e. do the “transfer learning” in the title - you just need to provide your labels etc. to give it the specific knowledge of your dataset. This page in the PL documentation refers to these things.
Apologies if I have misunderstood what you are trying to do.
BTW your code:
layer.trainable = False
; I would check the assumption that this does what you expect, i.e. confirm iteration order and that it is robust. # ignore text formatting introduced by forum ``` ```handling for me
for layer in self.vgg16.layers:
if layer.name == 'block5_conv1':
layer.trainable = True
else:
layer.trainable = False
or even just access that specific layer to set it trainable rather than use a loop
(i.e. code depends on detail of self.vgg16.trainable and layer.trainable and interactions, which I’m not familiar with
Hey, welcome to the forum @clarilla!
Sounds like yo want to make a larger part of the model trainable, will be cool to see the results of it
The most common way to retrain a VGG is to just retrain the last 3 Dense layers. You can do that in PerceptiLabs by using the standard settings of the VGG component and then dragging out 3 Dense layers behind it. This could be a good start to see how well it will train.