tkuanlun350 / Tensorflow-SegNet

Implement slightly different caffe-segnet in tensorflow
MIT License
369 stars 164 forks source link

AttributeError: module 'snappy' has no attribute 'compress' #13

Closed ddoe777 closed 7 years ago

ddoe777 commented 7 years ago

I am trying to run the example.sh file and getting the following error. Can someone help?

The model is set to Training Max training Iteration: 20000 Initial lr: 0.001000 CamVid Image dir: /Users/username/Downloads/Tensorflow-SegNet-master/CamVid/train.txt CamVid Val dir: /Users/username/Downloads/Tensorflow-SegNet-master/CamVid/val.txt Batch Size: 5 Log dir: /Users/username/Downloads/Tensorflow-SegNet-master/Logs/--image_dir=/Users/username/Downloads/Tensorflow-SegNet-master/CamVid/train.txt Filling queue with 146 CamVid images before starting to train. This will take a few minutes. Filling queue with 146 CamVid images before starting to train. This will take a few minutes. Traceback (most recent call last): File "main.py", line 52, in tf.app.run() File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "main.py", line 49, in main model.training(FLAGS, is_finetune=False) File "/Users/username/Downloads/Tensorflow-SegNet-master/model.py", line 369, in training loss, eval_prediction = inference(train_data_node, train_labels_node, batch_size, phase_train) File "/Users/username/Downloads/Tensorflow-SegNet-master/model.py", line 180, in inference conv1 = conv_layer_with_bn(norm1, [7, 7, images.get_shape().as_list()[3], 64], phase_train, name="conv1") File "/Users/username/Downloads/Tensorflow-SegNet-master/model.py", line 131, in conv_layer_with_bn conv_out = tf.nn.relu(batch_norm_layer(bias, train_phase, scope.name)) File "/Users/username/Downloads/Tensorflow-SegNet-master/model.py", line 171, in batch_norm_layer lambda: tf.contrib.layers.batch_norm(inputT, is_training=False, File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 296, in new_func return func(*args, *kwargs) File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1819, in cond orig_res_t, res_t = context_t.BuildCondBranch(true_fn) File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1694, in BuildCondBranch original_result = fn() File "/Users/username/Downloads/Tensorflow-SegNet-master/model.py", line 169, in lambda: tf.contrib.layers.batch_norm(inputT, is_training=True, File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/python/util/lazy_loader.py", line 53, in getattr module = self._load() File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/python/util/lazy_loader.py", line 42, in _load module = importlib.import_module(self.name) File "/Users/username/anaconda/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 978, in _gcd_import File "", line 961, in _find_and_load File "", line 950, in _find_and_load_unlocked File "", line 655, in _load_unlocked File "", line 678, in exec_module File "", line 205, in _call_with_frames_removed File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/contrib/init.py", line 31, in from tensorflow.contrib import factorization File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/contrib/factorization/init.py", line 24, in from tensorflow.contrib.factorization.python.ops.gmm import File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/contrib/factorization/python/ops/gmm.py", line 27, in from tensorflow.contrib.learn.python.learn.estimators import estimator File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/contrib/learn/init.py", line 88, in from tensorflow.contrib.learn.python.learn import File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/contrib/learn/python/init.py", line 23, in from tensorflow.contrib.learn.python.learn import File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/init.py", line 25, in from tensorflow.contrib.learn.python.learn import estimators File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/init.py", line 297, in from tensorflow.contrib.learn.python.learn.estimators.dnn import DNNClassifier File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn.py", line 30, in from tensorflow.contrib.learn.python.learn.estimators import dnn_linear_combined File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 31, in from tensorflow.contrib.learn.python.learn.estimators import estimator File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 49, in from tensorflow.contrib.learn.python.learn.learn_io import data_feeder File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/learn_io/init.py", line 21, in from tensorflow.contrib.learn.python.learn.learn_io.dask_io import extract_dask_data File "/Users/username/anaconda/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/learn_io/dask_io.py", line 26, in import dask.dataframe as dd File "/Users/username/anaconda/lib/python3.6/site-packages/dask/dataframe/init.py", line 5, in from .io import (from_array, from_pandas, from_bcolz, File "/Users/username/anaconda/lib/python3.6/site-packages/dask/dataframe/io/init.py", line 6, in from .csv import read_csv, to_csv, read_table File "/Users/username/anaconda/lib/python3.6/site-packages/dask/dataframe/io/csv.py", line 14, in from ...bytes import read_bytes File "/Users/username/anaconda/lib/python3.6/site-packages/dask/bytes/init.py", line 4, in from .core import read_bytes, open_files, open_text_files File "/Users/username/anaconda/lib/python3.6/site-packages/dask/bytes/core.py", line 9, in from .compression import seekable_files, files as compress_files File "/Users/username/anaconda/lib/python3.6/site-packages/dask/bytes/compression.py", line 32, in compress['snappy'] = snappy.compress AttributeError: module 'snappy' has no attribute 'compress'

ddoe777 commented 7 years ago

I figured out the issue. It was an issue with a different-version of snappy module being called. Weird! (Why do they have to name modules that are same? - Python should have a common site to see what names exist for a module- I guess!) I uninstalled the other module and got the right one working.