tensorflow / hub

A library for transfer learning by reusing parts of TensorFlow models.
https://tensorflow.org/hub
Apache License 2.0
3.47k stars 1.66k forks source link

Not able to retrain a model #258

Closed raviteja287 closed 5 years ago

raviteja287 commented 5 years ago

HI, I am trying to use retrain.py and while running the example given, I see there is no progress

python retrain.py --image_dir ~/flower_photos WARNING: Logging before flag parsing goes to stderr. W0326 00:53:44.968302 140314320787200 init.py:56] Some hub symbols are not available because TensorFlow version is less than 1.14 INFO:tensorflow:Looking for images in 'daisy' I0326 00:53:45.138642 140314320787200 retrain.py:181] Looking for images in 'daisy' INFO:tensorflow:Looking for images in 'dandelion' I0326 00:53:45.250454 140314320787200 retrain.py:181] Looking for images in 'dandelion' INFO:tensorflow:Looking for images in 'roses' I0326 00:53:45.398144 140314320787200 retrain.py:181] Looking for images in 'roses' INFO:tensorflow:Looking for images in 'sunflowers' I0326 00:53:45.487833 140314320787200 retrain.py:181] Looking for images in 'sunflowers' INFO:tensorflow:Looking for images in 'tulips' I0326 00:53:45.555453 140314320787200 retrain.py:181] Looking for images in 'tulips'

It stopped here for quite long time and there is no progress. Please help me out in this, as i need to retrain a new model

Thanks and regards, V Raviteja

rmothukuru commented 5 years ago

Hello raviteja287, Can you please provide the details mentioned below:

  1. Version of Tensorflow:
  2. Version of Tensorflow Hub:
  3. OS :
  4. Python Version:
Harshini-Gadige commented 5 years ago

Closing this issue as it is in "awaiting response" status for more than 7 days. Feel free to add your comments and we will reopen.

Ashwinimtech commented 5 years ago

i have also same issue please help anyone to retrain model.

Ashwinimtech commented 5 years ago

Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\admin\Downloads\class>python retrain.py --output_graph=retrained_graph. pb --output_labels=retrained_labels.txt --image_dir=C:\Users\admin\Downloads\cl ass\Images1 WARNING: Logging before flag parsing goes to stderr. W0506 21:03:59.432349 9960 init.py:56] Some hub symbols are not available b ecause TensorFlow version is less than 1.14 INFO:tensorflow:Looking for images in 'Angry' I0506 21:04:00.883151 9960 retrain.py:181] Looking for images in 'Angry' INFO:tensorflow:Looking for images in 'Calm' I0506 21:04:01.241952 9960 retrain.py:181] Looking for images in 'Calm' INFO:tensorflow:Looking for images in 'Happy' I0506 21:04:01.507152 9960 retrain.py:181] Looking for images in 'Happy' INFO:tensorflow:Looking for images in 'Sad' I0506 21:04:01.897153 9960 retrain.py:181] Looking for images in 'Sad' INFO:tensorflow:Looking for images in 'Yawning' I0506 21:04:02.131154 9960 retrain.py:181] Looking for images in 'Yawning' 2019-05-06 21:04:04.081157: W tensorflow/core/graph/graph_constructor.cc:1272] I mporting a graph with a lower producer version 26 into an existing graph with pr oducer version 27. Shape inference will have run different parts of the graph wi th different producer versions. WARNING:tensorflow:From C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\py thon\ops\control_flow_ops.py:3632: colocate_with (from tensorflow.python.framewo rk.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. W0506 21:04:06.374361 9960 deprecation.py:323] From C:\Users\admin\Anaconda3\li b\site-packages\tensorflow\python\ops\control_flow_ops.py:3632: colocate_with (f rom tensorflow.python.framework.ops) is deprecated and will be removed in a futu re version. Instructions for updating: Colocations handled automatically by placer. INFO:tensorflow:Saver not created because there are no variables in the graph to restore I0506 21:04:13.612774 9960 saver.py:1483] Saver not created because there are n o variables in the graph to restore WARNING:tensorflow:From C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\py thon\ops\losses\losses_impl.py:209: to_float (from tensorflow.python.ops.math_op s) is deprecated and will be removed in a future version. Instructions for updating: Use tf.cast instead. W0506 21:04:14.657976 9960 deprecation.py:323] From C:\Users\admin\Anaconda3\li b\site-packages\tensorflow\python\ops\losses\losses_impl.py:209: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future ve rsion. Instructions for updating: Use tf.cast instead. 2019-05-06 21:04:14.751576: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 INFO:tensorflow:100 bottleneck files created. I0506 21:04:32.224606 9960 retrain.py:474] 100 bottleneck files created. INFO:tensorflow:200 bottleneck files created. I0506 21:04:33.691009 9960 retrain.py:474] 200 bottleneck files created. INFO:tensorflow:300 bottleneck files created. I0506 21:04:34.299410 9960 retrain.py:474] 300 bottleneck files created. INFO:tensorflow:400 bottleneck files created. I0506 21:04:34.736211 9960 retrain.py:474] 400 bottleneck files created. INFO:tensorflow:500 bottleneck files created. I0506 21:04:35.391412 9960 retrain.py:474] 500 bottleneck files created. INFO:tensorflow:600 bottleneck files created. I0506 21:04:36.483414 9960 retrain.py:474] 600 bottleneck files created. INFO:tensorflow:Creating bottleneck at /tmp/bottleneck\Calm\resized_man-with-bri stle-on-calm-face-nature-background-defocused-man-with-beard-or-unshaven-guy-loo ks-handsome-outdoor-guy-bearded-and-attractive-cares-about-his-appea_0039.jpg_ht tps~tfhub.dev~google~imagenet~inception_v3~feature_vector~1.txt I0506 21:04:36.655014 9960 retrain.py:354] Creating bottleneck at /tmp/bottlene ck\Calm\resized_man-with-bristle-on-calm-face-nature-background-defocused-man-wi th-beard-or-unshaven-guy-looks-handsome-outdoor-guy-bearded-and-attractive-cares -about-his-appea_0039.jpg_https~tfhub.dev~google~imagenet~inception_v3~featurev ector~1.txt WARNING:tensorflow:From retrain.py:359: FastGFile.init (from tensorflow.pyth on.platform.gfile) is deprecated and will be removed in a future version. Instructions for updating: Use tf.gfile.GFile. W0506 21:04:36.655014 9960 deprecation.py:323] From retrain.py:359: FastGFile. _init__ (from tensorflow.python.platform.gfile) is deprecated and will be remove d in a future version. Instructions for updating: Use tf.gfile.GFile. Traceback (most recent call last): File "retrain.py", line 1333, in tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\platform\ap p.py", line 125, in run _sys.exit(main(argv)) File "retrain.py", line 1049, in main bottleneck_tensor, FLAGS.tfhub_module) File "retrain.py", line 469, in cache_bottlenecks resized_input_tensor, bottleneck_tensor, module_name) File "retrain.py", line 411, in get_or_create_bottleneck bottleneck_tensor) File "retrain.py", line 368, in create_bottleneck_file with open(bottleneck_path, 'w') as bottleneck_file: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/bottleneck\Calm\ resized_man-with-bristle-on-calm-face-nature-background-defocused-man-with-beard -or-unshaven-guy-looks-handsome-outdoor-guy-bearded-and-attractive-cares-about-h is-appea_0039.jpg_https~tfhub.dev~google~imagenet~inception_v3~feature_vector~1. txt'

C:\Users\admin\Downloads\class>

C:\Users\admin\Downloads\class>python retrain.py --output_graph=retrained_graph. pb --output_labels=retrained_labels.txt --image_dir=C:\Users\admin\Downloads\cl ass\Images1 Traceback (most recent call last): File "retrain.py", line 1333, in tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) AttributeError: module 'tensorflow' has no attribute 'app'

please help me.

alamehm commented 5 years ago

Hello all @rmothukuru Also same issue here, This problem happened when I flashed jetpack 3.3 in Jetson TX2 Tensorflow:1.8 Python: 2.7.12 Tensorflow hub :0.4.0 Linux Tegra ubuntu 4.4.38

Wannabeeeeee commented 5 years ago

Hello @raviteja287 , sorry to bother you, have you solved this problem? At first the program had run successfully several times, but once suddenly failed to work just like yours and never work again. It's really confuses me. Hope to get your help, sincerely thx.

rmothukuru commented 5 years ago

@andresusanopinto , Can you PTAL

raviteja287 commented 5 years ago

Hi,

Sorry for the late reply. There are some code changes added recently for log analysis in Tensorflow. I had checked the diff in git. When i installed Tensorflow around 4 months back, everything has run perfectly without any problem. But during the issue creation time I got this error. After that i checked the git difference and commented the code changes done. Then I see the code run without any issue. I would like to suggest developers to check the recent code changes added for log analysis.

Thanks and regards, Raviteja

On Thu, 30 May 2019, 21:13 rmothukuru, notifications@github.com wrote:

@andresusanopinto https://github.com/andresusanopinto , Can you PTAL

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tensorflow/hub/issues/258?email_source=notifications&email_token=ALVJEPDCXLJH7UT6KSXIDFLPX7Y33A5CNFSM4HBC3XY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWSV5EA#issuecomment-497376912, or mute the thread https://github.com/notifications/unsubscribe-auth/ALVJEPEV267R4DI6GA4F6CTPX7Y33ANCNFSM4HBC3XYQ .

alamehm commented 5 years ago

Hello

Yes i solved it. I am away of my office.

I will send you the details by Monday .

Best Regards

On Thu, May 30, 2019, 16:52 Wannabeeeeee <notifications@github.com wrote:

Hello @raviteja287 https://github.com/raviteja287 , sorry to bother you, have you solved this problem? At first the program had run successfully several times, but once suddenly failed to work just like yours and never work again. It's really confuses me. Hope to get your help, sincerely thx.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tensorflow/hub/issues/258?email_source=notifications&email_token=AJC4VOBXJKGCKKWFSS44R3LPX7S2JA5CNFSM4HBC3XY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWSRJXI#issuecomment-497358045, or mute the thread https://github.com/notifications/unsubscribe-auth/AJC4VOHMI7ORW3JHCX3ALRTPX7S2JANCNFSM4HBC3XYQ .

Wannabeeeeee commented 5 years ago

Hi, Sorry for the late reply. There are some code changes added recently for log analysis in Tensorflow. I had checked the diff in git. When i installed Tensorflow around 4 months back, everything has run perfectly without any problem. But during the issue creation time I got this error. After that i checked the git difference and commented the code changes done. Then I see the code run without any issue. I would like to suggest developers to check the recent code changes added for log analysis. Thanks and regards, Raviteja On Thu, 30 May 2019, 21:13 rmothukuru, @.***> wrote: @andresusanopinto https://github.com/andresusanopinto , Can you PTAL — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#258?email_source=notifications&email_token=ALVJEPDCXLJH7UT6KSXIDFLPX7Y33A5CNFSM4HBC3XY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWSV5EA#issuecomment-497376912>, or mute the thread https://github.com/notifications/unsubscribe-auth/ALVJEPEV267R4DI6GA4F6CTPX7Y33ANCNFSM4HBC3XYQ .

Hello, thank you for reply. I'm a beginner and wonder where log analysis can be found. I downloaded TensorFlow with pip, can I use git diff or have to use another method to check the changes? so sorry to disturb again.

Best regards

Wannabeeeeee commented 5 years ago

@alamehm

Thank you for your reply! Looking forward to the solution ;3

alamehm commented 5 years ago

Hi, Sorry for the late reply. There are some code changes added recently for log analysis in Tensorflow. I had checked the diff in git. When i installed Tensorflow around 4 months back, everything has run perfectly without any problem. But during the issue creation time I got this error. After that i checked the git difference and commented the code changes done. Then I see the code run without any issue. I would like to suggest developers to check the recent code changes added for log analysis. Thanks and regards, Raviteja On Thu, 30 May 2019, 21:13 rmothukuru, @.***> wrote: @andresusanopinto https://github.com/andresusanopinto , Can you PTAL — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#258?email_source=notifications&email_token=ALVJEPDCXLJH7UT6KSXIDFLPX7Y33A5CNFSM4HBC3XY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWSV5EA#issuecomment-497376912>, or mute the thread https://github.com/notifications/unsubscribe-auth/ALVJEPEV267R4DI6GA4F6CTPX7Y33ANCNFSM4HBC3XYQ .

Hello For me the problem was due to the call to : init_scope in tensorflow_hub/native_module.py you can check the latest version here: https://github.com/tensorflow/hub/blob/master/tensorflow_hub/native_module.py

According to the latest version (check the link) line 384

TODO(b/129142908): Hub should not use tf.init_scope since that makes

it incompatible with tf.compat.v1.wrap_function

Since I am not using a TPU, and to avoid compile erro, I removed this line : scope_func = tf.init_scope and replaced it with : lambda: tf.control_dependencies(None)

In my case, The local copy of this file was at: /usr/local/lib/python2.7/dist-packages/tensorflow_hub

It depends on your installation location. if it solved your problem, just like :+1:

andresusanopinto commented 5 years ago

Closing this bug because it has generic errors unrelated to each other. Please open specific separate bugs.

The only logs attached here are due to a incorrect system setup. My best guess would be this is due to either using the wrong python version, installs, or due to directories available in the users paths that make use the python binary instead of the system installed pip packages.