Open rezacsedu opened 7 years ago
I solve the error by your comment,thank you.
no need to downgrade numpy. The code looks like: ` import tensorflow as tf
import os
path=r'./audio_dataset/' os.chdir(path) print(os.getcwd())
filenames = tf.train.match_filenames_once('*.wav') count_num_files = tf.size(filenames)
filename_queue = tf.train.string_input_producer(filenames) init = (tf.global_variables_initializer(), tf.local_variables_initializer())
reader = tf.WholeFileReader() # По умолчанию считывает файл из библиотеки Tensorflow filename, file_contents = reader.read(filename_queue) #Выполняет операцию считывания with tf.Session() as sess: sess.run(init) num_files = sess.run (count_num_files) # Подсчитывает число файлов
coord = tf.train.Coordinator() # Инициализирует потоки
threads = tf.train.start_queue_runners(coord=coord)
for i in range(num_files):
audio_file = sess.run(filename)
print(audio_file)
`
When I executed, the audio_clustering.py script, I got the following error:
FailedPreconditionError (see above for traceback): Attempting to use uninitialized value matching_filenames [[Node: matching_filenames/read = IdentityT=DT_STRING, _class=["loc:@matching_filenames"], _device="/job:localhost/replica:0/task:0/cpu:0"]]
To solve this, I had to make the following changes:
Then I had to install/downgrade to numpy 1.11.0 using sudo pip install -U numpy==1.11.0
Maybe you can keep this note in your codes as well.