oandrienko / fast-semantic-segmentation

ICNet and PSPNet-50 in Tensorflow for real-time semantic segmentation
220 stars 41 forks source link

No module named 'graph_utils' #18

Closed zoeveryday closed 5 years ago

zoeveryday commented 5 years ago

oandrienko:

Thanks for your nice work on this.

I am following the instructions on "Training ICNet with Tensorflow", in Stage 2 - Compression and Retraining, I got and error as below while trying to run script python3 compress.py...

File "/home/work/×××/fast-semantic-segmentation/libs/filter_pruner.py", line 24, in <module> from graph_utils import GraphTraversalState ModuleNotFoundError: No module named 'graph_utils'

I tried to comment out LINE24, and re-run the script, and it gave me following errors...

Traceback (most recent call last):
  File "compress.py", line 103, in <module>
    tf.app.run()
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 124, in run
    _sys.exit(main(argv))
  File "compress.py", line 96, in main
    compressor.compress(FLAGS.input_checkpoint)
  File "/home/work/***/fast-semantic-segmentation/libs/filter_pruner.py", line 378, in compress
    self.neighbors = self._create_adjacency_list(self.output_node)
  File "/home/work/***/fast-semantic-segmentation/libs/filter_pruner.py", line 110, in _create_adjacency_list
    output_node = self.nodes_map[output_node_name]
KeyError: 'Predictions/postrain/Conv2D'

I am using python3.6.7 and tensorflow1.5.0 with CUDA9.1.

Any suggestion on how to fix this kind of issues? Thanks in advance.

smohan10 commented 5 years ago

In filter pruner I edited that line as from libs.graph_utils import GraphTraversalState and I see the same Key Error.

julienip commented 5 years ago

I removed "from graph_utils import GraphTraversalState" and changed line 378 : self.state = GraphTraversalState(already_visited={}, output_node_stack=[]) with: self.state = graph_utils.GraphTraversalState(already_visited={}, output_node_stack=[]) I have the same error.

oandrienko commented 5 years ago

@zoeveryday @smohan10 @julienip Hey guys, I am super sorry for the slow response. I have been away for awhile and had not had the chance to stay updated with the project as you all started using it.

Some others in another thread also had similar issues. I believe the KeyError you all were having was related to improper node names defined in the compression configs. I went through the whole codebase this week and fixed various bugs related to the compression process you all are having, which is reflected in 42c6bbe.

As a quick note: that the variable names have changed in the latest update to avoid the weird Prediction/postrain vsPrediction/pretrain convention I had when naming the PSPNet and ICNet output nodes. This is reflected in the updated models in the ModelZoo. If you have your own older checkpoints and want to use the updated codebase, you can also rename the nodes in your Tensorflow Checkpoints like I did. I used a simple name conversion script to do this which I found here. I rename CascadeFeatureFusion_0 -> CascadeFeatureFusion and *Predictions/postrain -> Predictions/Conv (for fine-tuning from PSPNEt, ICNet ignores all `Predictions` nodes)**.

oandrienko commented 5 years ago

@zoeveryday I will close this issue for now, but if any of you still have this issue after updated to 42c6bbe please re-open the issue and I will work through it. I will make sure to be much quicker with responses (also feel free to shoot me an email).