Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue found on chapter 5 (clustering) #13

Open
rezacsedu opened this issue May 10, 2017 · 2 comments
Open

Issue found on chapter 5 (clustering) #13

rezacsedu opened this issue May 10, 2017 · 2 comments

Comments

@rezacsedu
Copy link

rezacsedu commented May 10, 2017

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:

  1. I had to initialize the local variables using tf.local_variables_initializer()
  2. 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.

@benjaminxz
Copy link

I solve the error by your comment,thank you.

@zoldaten
Copy link

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)
#print(count_num_files)
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) # Подсчитывает число файлов
#print(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)
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants