मैं एमएल के लिए अपेक्षाकृत नया हूं और टेन्सफ़ोर्फ़्लो के लिए बहुत नया हूं। मैंने अपने डेटा को पढ़ने का तरीका जानने और समझने के लिए टेंसरफ्लो मिनी ट्यूटोरियल के साथ-साथ https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/how_tos/reading_data पर काफी समय बिताया है, लेकिन मुझे थोड़ी उलझन में आ रहा है।एक निर्देशिका में छवियों को लोड करना Tensorflow डेटा सेट
मेरे पास निर्देशिका/छवियों/0_Non/में छवियों (.png) का एक गुच्छा है। मैं इन्हें एक टेंसरफ्लो डेटा सेट में बनाने की कोशिश कर रहा हूं, इसलिए मैं मूल रूप से मिनी पास ट्यूटोरियल से सामग्री को पहले पास के रूप में चला सकता हूं।
import tensorflow as tf
# Make a queue of file names including all the JPEG images files in the relative image directory.
filename_queue = tf.train.string_input_producer(tf.train.match_filenames_once("../images/0_Non/*.png"))
image_reader = tf.WholeFileReader()
# Read a whole file from the queue, the first returned value in the tuple is the filename which we are ignoring.
_, image_file = image_reader.read(filename_queue)
image = tf.image.decode_png(image_file)
# Start a new session to show example output.
with tf.Session() as sess:
# Required to get the filename matching to run.
tf.initialize_all_variables().run()
# Coordinate the loading of image files.
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(coord=coord)
# Get an image tensor and print its value.
image_tensor = sess.run([image])
print(image_tensor)
# Finish off the filename queue coordinator.
coord.request_stop()
coord.join(threads)
मुझे यहां क्या हो रहा है समझने में कुछ परेशानी हो रही है। तो ऐसा लगता है कि image
एक टेंसर है और image_tensor
एक numpy सरणी है?
मैं अपनी छवियों को डेटा सेट में कैसे प्राप्त करूं? मैंने आईरिस उदाहरण के साथ भी निम्नलिखित कोशिश की जो एक सीएसवी के लिए है जो मुझे यहां लाया: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/learn/python/learn/datasets/base.py, लेकिन यह सुनिश्चित नहीं था कि यह मेरे मामले के लिए काम कैसे करे, जहां मेरे पास पीएनजी का गुच्छा है।
धन्यवाद!
आप प्रकार का पता लगाने के लिए प्रकार (छवि) का उपयोग कर सकते हैं। एमएनआईएसटी उदाहरणों से आपका डेटासेट प्रारूप/संगठन अलग कैसे है? क्या आप उसी कोड का पुनः उपयोग कर सकते हैं जो एमएनआईएसटी उदाहरण डेटा लोड करता है? –
हम्म। एमएनआईएसटी उदाहरण ऐसा लगता है कि डेटा .tar.gz प्रारूप के रूप में आ रहा है? क्या यह काम करेगा यदि मैंने अभी अपनी पीएनजी की निर्देशिका .tar.gz प्रारूप के रूप में बनाई है? – Vincent