GithubHelp home page GithubHelp logo

Comments (4)

galeone avatar galeone commented on May 18, 2024

As you can see from the error

NotFoundError (see above for traceback): /Users/liuguiyang/Documents/CodeProj/PyProj/dtb/scripts/inputs/data/airplane/positive/32size/0335.png:1

The file /Users/liuguiyang/Documents/CodeProj/PyProj/dtb/scripts/inputs/data/airplane/positive/32size/0335.png:1 does not exist.

Check the content of image.list and look if the files listed there effectively exists.

(the :1 in the file name sounds strange to me, check this)

from dynamic-training-bench.

liuguiyangnwpu avatar liuguiyangnwpu commented on May 18, 2024

hi,
after i check the imag.list, I can read the *.png images.

import os
import tensorflow as tf

filename = "/Users/liuguiyang/Documents/CodeProj/PyProj/dtb/scripts/inputs/data/airplane/positive/32size/0335.png"

def test02():
#    filename = "/Users/liuguiyang/Desktop/cifar/test/0_cat.png"
    with tf.Graph().as_default():
        image_contents = tf.read_file(filename)
        image = tf.image.decode_png(image_contents, channels=3)
        init_op = tf.tables_initializer()
        with tf.Session() as sess:
            sess.run(init_op)
            tmp = sess.run(image)
            print(tmp)
if __name__ == "__main__":
    test02()

the answer is below:

➜  dtb git:(CAE) ✗ python3 run.py > a.txt
➜  dtb git:(CAE) ✗ more a.txt 
[[[173 173 173]
  [173 173 173]
  [173 173 173]
  ..., 
  [176 176 176]
  [100 100 100]
  [117 117 117]]

 [[175 175 175]
  [174 174 174]
  [173 173 173]
  ..., 
  [177 177 177]
  [149 149 149]
  [136 136 136]]

 [[175 175 175]
  [173 173 173]
  [171 171 171]
  ..., 
  [173 173 173]
  [173 173 173]
  [161 161 161]]

 ..., 
 [[173 173 173]
  [173 173 173]
  [172 172 172]
  ..., 
  [174 174 174]
  [173 173 173]
  [173 173 173]]

 [[173 173 173]
  [173 173 173]
  [173 173 173]
  ..., 
  [152 152 152]
  [171 171 171]
  [170 170 170]]

 [[172 172 172]
  [172 172 172]
  [172 172 172]
  ..., 
  [146 146 146]
  [170 170 170]
  [173 173 173]]]

it really can read the image data.
I am very confused about this question ???

from dynamic-training-bench.

galeone avatar galeone commented on May 18, 2024

Your input pipeline was correct (the commented part, not the modified version you posted here with comments added and debug operations added), the only problem I see is in the image.list file content.

The image you read here does not have the :1 added at the end and the read operation worked well. Thus if every file listed in image.list exists everything should work fine

from dynamic-training-bench.

liuguiyangnwpu avatar liuguiyangnwpu commented on May 18, 2024

hi,
i am very confused why my code is error?
But in another way, I get the same effect, below is my code.

import tensorflow as tf

filename_queue = tf.train.string_input_producer(
    tf.train.match_filenames_once("/Users/liuguiyang/Documents/CodeProj/PyProj/dtb/scripts/inputs/data/airplane/positive/32size/*.png")
)

image_reader = tf.WholeFileReader()
key, img_file = image_reader.read(filename_queue)
img = tf.image.decode_png(img_file)

with tf.Session() as sess:
    tf.global_variables_initializer().run()
    coord = tf.train.Coordinator()
    threads = tf.train.start_queue_runners(coord=coord)

    img_tensor = sess.run([img])
    print(img_tensor)

    coord.request_stop()
    coord.join(threads=threads)

thank you for your help ?

from dynamic-training-bench.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.