danielvarga / keras-finetuning Goto Github PK
View Code? Open in Web Editor NEWTraining an InceptionV3-based image classifier with your own dataset
Training an InceptionV3-based image classifier with your own dataset
Hi Daniel.
Thanks for uploading the post, I have learned a lot from studying the code but I am having trouble running webcam.py. When I try to run it I get this error ValueError: You are trying to load a weight file containing 190 layers into a model with 2 layers.
Hi,
when I run train.py on some test data I get the following error.
Any advise ?
Traceback (most recent call last):
File "train.py", line 34, in <module>
X, y, tags = dataset.dataset(data_directory, n)
File "dataset.py", line 47, in dataset
assert chan == 3
AssertionError
Throws the following error as soon as the images are loaded:
Contents of keras.json:
{
"image_dim_ordering": "th",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tensorflow"
}
P.S. : Even tried replacing 'th' with 'tf', but I guess the part causing this error comes before any difference between 'th' and 'tf' can appear.
ValueError: NumpyArrayIterator is set to use the data format convention "channels_last" (channels on axis 3), i.e. expected either 1, 3 or 4 channels on axis 3. However, it was passed an array with shape (80, 3, 224, 224) (224 channels).
I can load dataset and model successfully, but I can't find the answer online. I run the code in windows7, and I modify the code, so I don't know the reason. Is this a problem with data processing?
Hitting an error here when i run the script, going to have a look around now i think there is something wrong with pillow in my environment though i have tried to create a fresh env and im still hitting the same error!
Using TensorFlow backend. loading dataset Traceback (most recent call last): File "train.py", line 34, in <module> X, y, tags = dataset.dataset(data_directory, n) File "/Users/roryw10/keras-finetuning/dataset.py", line 45, in dataset img = scipy.misc.imread(filename) File "//anaconda/envs/finetune/lib/python2.7/site-packages/scipy/misc/pilutil.py", line 154, in imread im = Image.open(name) File "//anaconda/envs/finetune/lib/python2.7/site-packages/PIL/Image.py", line 1980, in open raise IOError("cannot identify image file") IOError: cannot identify image file
I got this error while running train.py file, I use Theano backend.
training the newly added dense layers
Epoch 1/20
Traceback (most recent call last):
File "train.py", line 134, in
File "/Users/justinushermawan/tensorflow/lib/python2.7/site-packages/keras/engine/training.py", line 1475, in fit_generator
class_weight=class_weight)
File "/Users/justinushermawan/tensorflow/lib/python2.7/site-packages/keras/engine/training.py", line 1244, in train_on_batch
check_batch_dim=True)
File "/Users/justinushermawan/tensorflow/lib/python2.7/site-packages/keras/engine/training.py", line 1000, in _standardize_user_data
check_loss_and_target_compatibility(y, self.loss_functions, self.internal_output_shapes)
File "/Users/justinushermawan/tensorflow/lib/python2.7/site-packages/keras/engine/training.py", line 196, in check_loss_and_target_compatibility
' while using as loss categorical_crossentropy
. '
Exception: You are passing a target array of shape (3, 1) while using as loss categorical_crossentropy
. categorical_crossentropy
expects targets to be binary matrices (1s and 0s) of shape (samples, classes). If your targets are integer classes, you can convert them to the expected format via:
from keras.utils.np_utils import to_categorical
y_binary = to_categorical(y_int)
Alternatively, you can use the loss function sparse_categorical_crossentropy
instead, which does expect integer targets.
When using the theano backend for running this code, the fine-tuning of the top layer runs perfectly fine. However, as soon as the tweaking of the penultimate layer starts, the following error is thrown:
I've tried running the code thrice on different data-sets (to make sure that it isn't a problem with corrupt,invalid data,etc.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.