Exactly right
Yes, it is a way to do transfer learning
We will discuss that in lesson 2
Itâs installed automatically in the AWS AMI. If youâre not using that, youâll need to install it yourself. If youâve followed our advice and are using anaconda, just type conda install bcolz
. If youâre not following our advice and are using anaconda, you may want to reconsider - otherwise youâll have to figure out how to fix the pip install
iTerm2 is very useful and seems a lot easier, thanks again
Hey @mclasson What is your setup while running the Model of VGG16?
This might be an issue with not having the supported installations for your machine, either GPU or the drivers related such as cuDnn, are those things in place?
Please look at your keras configuration. It might be configured for tensorflow.
I faced the same issue.
To solve the issue I have changed the keras configuration file.
~/.keras/keras.json
{
âimage_dim_orderingâ: âthâ,
âepsilonâ: 1e-07,
âfloatxâ: âfloat32â,
âbackendâ: âtheanoâ
}
Thanks. I had two problems. g++ missing and keras using Tensorflow as you suggested. Now I instead get this one:
Exception: The shape of the input to âFlattenâ is not fully defined (got (0, 7, 512). Make sure to pass a complete âinput_shapeâ or âbatch_input_shapeâ argument to the first layer in your model. after printing this
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
Beautiful! Helped me a lot. Thanks
Is there a way to save the trained model so it can be reused by loading it?
You can use model.save(filepath) and model.load_model(filepath) .
See https://keras.io/getting-started/faq/
You can also save the âtrainingâ, the model weights, with model.save_weights(filepath) and model.load_weights(filepath).
Is the âweightsâ exactly the same as a model? In another word, does âmodel_saveâ function the same as âsave_weightsâ?
Training accuracy VS validation accuracy. In lesson 1, I trained on a small portion of the data, a little more than 1000 instances.
Why is the highest training accuracy is under 90%, but the validation accuracy is still over 97%?
1655/1655 [==============================] - 1047s - loss: 0.5973 - acc: 0.8749 - val_loss: 0.1039 - val_acc: 0.9759
I am also using a smaller validation set.
model.save(filepath) saves everything.
model.save_weights(filepath) save only the the weights. You need the actual model definition.
Why is the highest training accuracy is under 90%, but the validation accuracy is still over 97%?
Keep going with the videos. This is covered in detail in Lesson 3.
batch_size = 64
vgg = Vgg16()
path = "data/redux/"
vgg.model.load_model(path+âresults/model.h5â)
I tested with replacing âload_weightsâ with âload_modelâ, however, I received this error:
Using Theano backend.
Traceback (most recent call last):
File â/home/abigail/workspace/fast-ai/redux_test.pyâ, line 14, in
vgg.model.load_model(path+âresults/model.h5â)
AttributeError: âSequentialâ object has no attribute âload_modelâ
Why canât it load?
I never used itâŠbutâŠ
You probably do not need "vgg = Vgg16()"
and it should be âvgg=â, it should return the model.
vgg=model.load_model(path+âresults/model.h5â)
@james_goldfarb, i think i know whatâs going on. It would take a while to modify the code to use load and save âmodelâ in lesson one, due to the use of the pretrained model.
You probably didnât set image_dim_ordering to th. See the post immediately above yours.
Where to enable theano for Keras in Vgg16?
According to Keras documentations, https://keras.io/getting-started/faq/#how-can-i-run-keras-on-gpu. In order to run GPU on theano, it needs to do something like this:
import theano
theano.config.device = 'gpuâ
theano.config.floatX = âfloat32â
However, I canât see where this is set in either Utility.py or vgg16.py. Hi, @jeremy, could you shed some light on this? Just curious.