Model.pop() returning error

Hi,

I am currently working on regression problem where the count of instances is required. I am using the Vgg16BN model. my code is as follows

train_data_dir = r'FPTest\train'
validation_data_dir = r'FPTest\valid'            

trn=get_batches_t(train_data_dir)
val=get_batches_v(validation_data_dir)

model_v=Vgg16BN()
model_v.pop()
for layer in model_v.layers: layer.trainable=False
model_v.add(Dense(1,activation='Relu'))

however I get the following error.

C:\Users\satish\Anaconda\Deep Test>python fiber_count.py
Using Theano backend.
Using gpu device 0: GeForce 840M (CNMeM is enabled with initial size: 80.0% of memory, cuDNN 5103)
Found 123 images belonging to 10 classes.
Found 20 images belonging to 10 classes.
Traceback (most recent call last):
  File "fiber_count.py", line 63, in <module>
    model_v.pop()
AttributeError: Vgg16BN instance has no attribute 'pop'

not sure why I am getting this error. Anybody else face similar problem?

ps. have modified the get_batches so that the labels get converted into float with the number of instances.

Regards
Satish

Vgg16BN is a wrapper class around the real model.

You need model_v.model.pop()

1 Like

Thanks for the suggestion. Did the trick.