yeephycho / tensorflow_input_image_by_tfrecord Goto Github PK
View Code? Open in Web Editor NEWFeed your own image data to a pre-trained network by tensorflow
License: Apache License 2.0
Feed your own image data to a pre-trained network by tensorflow
License: Apache License 2.0
Hi,
I'm trying to run read_tfrecord_data.py after running build_image_data.py successfully. read_tfrecord_data.py giving me an error message as follow:
File "read_tfrecord_data.py", line 27
self.image = tf.Variable([], dtype = tf.string)
^
TabError: inconsistent use of tabs and spaces in indentation
I didn't write the code nor changed it. I used clone to get the files.
Is there any ideas on how to solve this issue.
Best,
IA
博主,你好,在src/dog文件夹下,有一个test文件,我怀着对未知事物充满好奇的心情,用激动地颤抖的手,握着鼠标,虔诚地点开了它。果然,没让我失望,屏幕赫赫出现一句:“知识就是力量”。于是,我忍不住开了这个issue。
Hi I'm trying to get your program to run on the sample data and I keep getting an error. I've tried using python 3.6 with tf 1.4 and even python 3.5 with tf 0.12 but I get an error. I'm on MacOS but I can VM if I need to.
Hello, I learned a lot from your this example. I tried to modefied the code to read the tfrecord file and feed into the graph, but I met some problems.
Can you help solve my problem?
https://stackoverflow.com/questions/46985411/tensorflow-read-tfrecord-without-a-graph
I run the examples in README
"python build_image_data.py"
OK
Wrote 150 images to ./train-00000-of-00002
Wrote 150 images to ./train-00001-of-00002
Then I run next command
"python read_tfrecord_data.py --image_number=300 --class_number=3 --image_height=299 --image_width=299"
20 files were found under current folder.
Please be noted that only files end with '*.tfrecord' will be load!
Cannot find any tfrecord files, please check the path.
How does the creation of filename.tfrecord happen?
python build_image_data.py
Saving results to ./
Determining list of input files and labels from ./.
Found 302 JPEG files across 3 labels inside ./.
Launching 2 threads for spacings: [[0, 151], [151, 302]]
2018-01-23 00:37:19.690943 [thread 0]: Wrote 0 images to 151 shards.
2018-01-23 00:37:19.691943 [thread 1]: Wrote 0 images to 151 shards.
2018-01-23 00:37:20.692609: Finished writing all 302 images in data set.
Determining list of input files and labels from ./.
Found 302 JPEG files across 3 labels inside ./.
Launching 2 threads for spacings: [[0, 151], [151, 302]]
2018-01-23 00:37:22.013490: Finished writing all 302 images in data set.
Exception in thread Thread-3:
Traceback (most recent call last):
File "C:\Users\Francis\AppData\Local\Programs\Python\Python35\lib\threading.py", line 914, in _bootstrap_inner
self.run()
File "C:\Users\Francis\AppData\Local\Programs\Python\Python35\lib\threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "build_image_data.py", line 264, in _process_image_files_batch
image_buffer, height, width = _process_image(filename, coder)
File "build_image_data.py", line 203, in _process_image
image_data = f.read()
File "C:\Users\Francis\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 125, in read
pywrap_tensorflow.ReadFromStream(self._read_buf, length, status))
File "C:\Users\Francis\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 93, in _prepare_value
return compat.as_str_any(val)
File "C:\Users\Francis\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\util\compat.py", line 106, in as_str_any
return as_str(value)
File "C:\Users\Francis\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\util\compat.py", line 84, in as_text
return bytes_or_text.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Exception in thread Thread-4:
Traceback (most recent call last):
File "C:\Users\Francis\AppData\Local\Programs\Python\Python35\lib\threading.py", line 914, in _bootstrap_inner
self.run()
File "C:\Users\Francis\AppData\Local\Programs\Python\Python35\lib\threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "build_image_data.py", line 264, in _process_image_files_batch
image_buffer, height, width = _process_image(filename, coder)
File "build_image_data.py", line 203, in _process_image
image_data = f.read()
File "C:\Users\Francis\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 125, in read
pywrap_tensorflow.ReadFromStream(self._read_buf, length, status))
File "C:\Users\Francis\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 93, in _prepare_value
return compat.as_str_any(val)
File "C:\Users\Francis\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\util\compat.py", line 106, in as_str_any
return as_str(value)
File "C:\Users\Francis\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\util\compat.py", line 84, in as_text
return bytes_or_text.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 3131: invalid start byte
2018-01-23 00:37:19.430514: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
python read_tfrecord_data.py --image_number=300 --class_number=3 --image_height=299 --image_width=299
20 files were found under current folder.
Please be noted that only files end with '*.tfrecord' will be load!
Cannot find any tfrecord files, please check the path.
Traceback (most recent call last):
File "read_tfrecord_data.py", line 70, in
shuffle = True)
File "C:\Users\Francis\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\training\input.py", line 217, in string_input_producer
raise ValueError(not_null_err)
ValueError: string_input_producer requires a non-null input tensor
I am trying to use your tutorial.
So in the build_image_data.py file we have the following:
tf.app.flags.DEFINE_string('train_directory', './',
'Training data directory')
tf.app.flags.DEFINE_string('validation_directory', './',
'Validation data directory')
tf.app.flags.DEFINE_string('output_directory', './',
'Output data directory')
Should I do anything after I do "cd ../tensorflow_input_image_by_tfrecord/src"? Do I need to create folders namely Output data directory, Validation data directory, Training data directory?
When I just run the code as it is explained, I receive the error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 110: invalid start byte
How exactly do I create a labels file? I know what should go in it (valid labels, line by line), but what do I need to name it and where do I store it? At this point I have 6 folders -- "Bullfrogs," "Salamanders," "Goldfish," "Bullfrogs_t" (testing images of bullfrogs), "Salamanders_t" and "Goldfish_t". I want to create a classification algorithm in TensorFlow (don't actually need it, just practicing for when I have my real data). Can you help me? Thanks so much for creating this script.
Hi, @yeephycho
After run build_image_data.py,output two file:
python read_tfrecord_data.py --image_number=300 --class_number=3 --image_height=299 --image_width=299
generate an error:
Please be noted that only files end with '*.tfrecord' will be load!
Cannot find any tfrecord files, please check the path.
Because it cannot find any *.tfrecord file.
Solution:
Modify the line 253 of build_image_data.py :
output_filename = '%s-%.5d-of-%.5d' % (name, shard, num_shards)
to
output_filename = '%s-%.5d-of-%.5d.tfrecord' % (name, shard, num_shards)
Need the code to predict an image for the model trained using flower_train_cnn.py. Was trying to use conv_mnist_inference.py and match the parameters in the evaluation logic in flower_train_cnn.py.
BATCH_SIZE = 10
x = tf.placeholder(tf.float32, shape=[BATCH_SIZE, 5])
x_image = tf.reshape(x, [-1, IMAGE_SIZE, IMAGE_SIZE, 3])
Getting the following error
ValueError: Dimension size must be evenly divisible by 150528 but is 50 for 'Reshape' (op: 'Reshape') with input shapes: [10,5], [4] and with input tensors computed as partial shapes: input[1] = [?,224,224,3].
Also i suppose the same flower_train_cnn.py would work for training any tfrecord files we create using the images and label,txt by running the command build_image_data.py.
Was a bit confused http://yeephycho.github.io/2016/08/15/image-data-in-tensorflow/ following the link. and hence need your guidance.
Thanking you.
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.