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

AttributeError: module 'tensorflow._api.v2.train' has no attribute 'slice_input_producer' #29

Open
rasutt opened this issue Aug 25, 2021 · 2 comments

Comments

@rasutt
Copy link

rasutt commented Aug 25, 2021

Hi there,

I am trying to test the species model on the example images. At first I got the error

Traceback (most recent call last):
File "run.py", line 412, in
main()
File "run.py", line 351, in main
sess = tf.Session(config=tf.ConfigProto(
AttributeError: module 'tensorflow' has no attribute 'Session'

So I uncommented the lines

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

and now I get the error

Traceback (most recent call last):
File "run.py", line 412, in
main()
File "run.py", line 394, in main
do_evaluate(sess, args)
File "run.py", line 224, in do_evaluate
val_images, val_labels, val_info = val_loader.load()
File "/home/robinaldridge-sutton/Code/MLWIC2/MLWIC2_helper_files/data_loader.py", line 140, in load
filename_queue = tf.train.slice_input_producer([filenames, labels], shuffle= self.shuffle if self.is_training else False)
AttributeError: module 'tensorflow._api.v2.train' has no attribute 'slice_input_producer'

I found a recommendation to use tf.data.Dataset.from_tensor_slices, as tf.train.slice_input_producer is apparently now deprecated.

I'm not sure if this package is still being maintained or if there might be something new in the works?

@dlknapps
Copy link

dlknapps commented Aug 2, 2022

Hi there, I was running into similar issues with TensorFlow. After researching, I found that the version of TensorFlow may be the problem. Setting up my environment in Anaconda with Python version 3.7 and Tensorflow version 1.15 fixed the issues. I still received TensorFlow errors in R when running the code, but the Classify function was able to run and produce a .csv file with the AI's suggestions for image identification. [https://github.com/dlknapps/Anaconda-Enviorment-Fix-for-MLWIC2]

@bradyp97
Copy link

Hello @mikeyEcology, I received the same error rasutt described last year. Here is the output for your reference. I have r-reticulate activated, Python 3.7, and Tensorflow 1.14, but I am receiving this error. Could you please help me to resolve this?

Your data_info file exists: /Users/bradyparlato/Desktop/image_labels.csv.
Your `path_prefix exists: /Users/bradyparlato/Desktop/images.
You are not using a Windows computer.
Traceback (most recent call last):
File "/Users/bradyparlato/Desktop/MLWIC2_helper_files/run.py", line 412, in
main()
File "/Users/bradyparlato/Desktop/MLWIC2_helper_files/run.py", line 351, in main
sess = tf.Session(config=tf.ConfigProto(
AttributeError: module 'tensorflow' has no attribute 'Session'
The classify function did not run properly.

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