When following the Readme to fine-tune Google's Inception-v3 image classification model, I get the error:
File "/Path/to/Model/bazel-bin/inception/flowers_train.runfiles/inception/inception/slim/ops.py", line 88, in batch_norm
initializer=tf.zeros_initializer(),
TypeError: zeros_initializer() takes at least 1 argument (0 given)
This occurs after running the final command:
bazel-bin/inception/flowers_train \
--train_dir="${TRAIN_DIR}" \
--data_dir="${FLOWERS_DATA_DIR}" \
--pretrained_model_checkpoint_path="${MODEL_PATH}" \
--fine_tune=True \
--initial_learning_rate=0.001 \
--input_queue_memory_factor=1
I have 0 idea whats going on here as this error gets thrown from a python file written by the TF team. Additionally, being a TF newbie, I do not know my way around enough to attempt a deep debugging session. Just by looking at the path from the error, there might be an issue with the script running TF slim code?
Anyhow, I am running macOS Sierra with Python 3.6 and the TensorFlow Python API r0.12.
So turns out this error was thrown if the current installation of tensorflow did not have the most recent tensorflow-slim code. Install directions here.
Related
I tried running this command but i get erros that i dont have tenserflow 2.2 or higher. But I checked and I have the correct version of tenserflow. I also did pip3 install keras command
I know for a fact that all of the code is correct because it worked for my teacher the other day and nothing has changed. I just need to run his commands but i keep running into problems
I am doing this course following everything he does in a recorded video so there must be no issue there but for some reason it just doesn't work
just install tensorflow as requested in the last line of the error message: pip install tensorflow. It is needed as backend for Keras.
Also, since keras is part of tensorflow now, I recommend to write imports as from tensorflow.keras.[submodule name] import instead of from keras.[submodule name] import
I am trying to train a resnet model for CIFAR10 using the following repo in tensorflow: https://github.com/stanford-futuredata/dawn-bench-models/tree/master/tensorflow/CIFAR10/resnet. Even though the readme mentions tensorflow 1.2, I got a Could not find a version that satisfies the requirement tensorflow==1.2 when trying to install, so I am instead using tensorflow 1.15. I am also using Python 3.7.6 and running on a Mac. When I try to run the training script resnet_main.py:
python3 resnet/resnet_main.py --train_data_path=cifar10/data_batch* \
--log_root=/tmp/resnet_model \
--train_dir=/tmp/resnet_model/train \
--dataset='cifar10'
I get the following command line error: zsh: no matches found: --train_data_path=cifar10/data_batch*. I imagine it has to do with the *, though I'm not sure, and I'm not sure what the work around is. Thanks!
The answer is as simple as adding single quotes, such as --train_data_path='cifar10/data_batch*', for all the filepaths.
i am trying 2 get a AI via the AI course by Sentdex i didnt get the install working at first, got the mac version (i am using win) then i try running the prepeare file in the setup dir and it gives me this error:
Error importing tensorflow. Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.
anyone know what 2 do?
I have retrained Tensorflow's Inception V3's last layer on a flower dataset. This was done using:
bazel-bin/tensorflow/examples/image_retraining/retrain --image_dir ~/flower_photos
The training was successful, and then I ran:
bazel build tensorflow/examples/label_image:label_image
This too ran fine and next I ran:
bazel-bin/tensorflow/examples/label_image/label_image \
--graph=/tmp/output_graph.pb --labels=/tmp/output_labels.txt \
--output_layer=final_result \
--image=$HOME/flower_photos/daisy/21652746_cc379e0eea_m.jpg
When I run this, I receive an error that says
E tensorflow/examples/label_image/main.cc:285] Not found: Failed to load compute graph at '/tmp/output_graph.pb'
Any help is greatly appreciated, thank you.
I have run this using following command instead of bazel and I found it easier.
python /path_to_file/label_image.py /path_to_image/image.jpeg
First make sure that graph is created after you run retrain.py and it is at the correct location. (default is inside /tmp/). If you want you can get the script here and you can change the file locations as per your need.
Note: If graph file is not created you may want to check this regarding running retrain.py
I am trying to run a Keras script on an AWS instance. While the script runs fine on my own computer (Python 2.7 - no CPU) it causes an error on AWS. I have installed the latest version of Theano - and other scripts (e.g. the mnist tutoral) do not give errors. The script that is causing the issue is a standard Keras tutoral script (https://github.com/fchollet/keras/blob/master/examples/cifar10_cnn.py). The error is copied in per below (apologies - there might be a better way to capture errors straight from the command line). Any help much appreciated
First page of error message:
End of error message (i have not copied in the entire stack of keras/layers errors)
Somehow you're passing a symbolic value for the border_mode parameter. If this works fine on CPU but not on GPU then, for some reason, the CPU version of the code supports symbolic border modes but the GPU version does not.
If you can, change the border_mode parameter value to be a Python literal instead of a Theano symbolic variable.