Closed cookiegg closed 6 years ago
Are you sure you have keras 2.1.1? I get this error when I try to use 2.1.2.
On Dec 15, 2017 1:58 AM, "cookiegg" notifications@github.com wrote:
hi, tstandley, I have some trouble when I run your code. Can you help me?
my system environment: ubuntu 14.04 64bit python 3.6.1 (anaconda, but the package you mentioned were installed with 'pip') tensorflow 1.3.0 keras: 2.1.1
when I run the following command:
python3 predict_mass.py test_set_images/red_lego_brick_4.jpg 2.5001 1.25 0.9 2>/dev/null
the output is:
models/shape_aware.h5
And if run:
python3 predict_mass.py test_set_images/red_lego_brick_4.jpg 2.5001 1.25 0.9
the output is:
Using TensorFlow backend. models/shape_aware.h5XXX lineno: 206, opcode: 0 Traceback (most recent call last): File "predict_mass.py", line 9, in
shape_aware_model = ComplexModel() File "/data/Documents/image2mass/model_wrapper.py", line 88, in init self.model, self.model_name = get_model('shape_aware') File "/data/Documents/image2mass/model_wrapper.py", line 14, in get_model model = keras.models.load_model(newest) File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/models.py", line 240, in load_model model = model_from_config(model_config, custom_objects=custom_objects) File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/models.py", line 314, in model_from_config return layer_module.deserialize(config, custom_objects=custom_objects) File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/layers/init.py", line 55, in deserialize printable_module_name='layer') File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 139, in deserialize_keras_object list(custom_objects.items()))) File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/engine/topology.py", line 2500, in from_config process_node(layer, node_data) File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/engine/topology.py", line 2457, in process_node layer(input_tensors[0], kwargs) File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/engine/topology.py", line 603, in call output = self.call(inputs, kwargs) File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/layers/core.py", line 651, in call return self.function(inputs, **arguments) File "/home/tstand/Dropbox/image2weight/volume_model/volume_model.py", line 206, in preprocess_img_for_xceptionSystemError: unknown opcode This is my file tree:
├── features.py ├── image_util.py ├── models │ ├── cnn_w_alde.h5 │ ├── no_geometry.h5 │ ├── pure_cnn.h5 │ └── shape_aware.h5 ├── model_wrapper.py ├── model_wrapper.pyc ├── pklzs │ ├── score_to_percentile.pklz │ └── vgg_nearest_neighbor_data-003.pkl ├── predictions.txt ├── predict_mass.py ├── produce_latex_chart.py ├── pycache │ ├── features.cpython-36.pyc │ ├── model_wrapper.cpython-36.pyc │ └── util.cpython-36.pyc ├── README.md ├── test_set_images │ ├── 15_puzzle_1.jpg| ... │ └── wooden_train_track_9.jpg ├── thickness_model.h5 └── util.py
This error seems to happen while reading the network model. In particular, the last called file is /home/tstand/Dropbox/ image2weight/volume_model/volume_model.py , seems is the absolute path of this file in your computer.
Can you give me some tips on how to fix this problem?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tstandley/image2mass/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AQYA3s3K3zqjeGNzTSkV0TXC_BC9Wexrks5tAkLQgaJpZM4RDQOH .
yes, the version is 2.1.1
And I replace keras 2.1.1 with keras 2.1.2, another error appears:
Using TensorFlow backend.
models/shape_aware.h5
Traceback (most recent call last):
File "predict_mass.py", line 9, in <module>
shape_aware_model = ComplexModel()
File "/data/Documents/image2mass/model_wrapper.py", line 88, in __init__
self.model, self.model_name = get_model('shape_aware')
File "/data/Documents/image2mass/model_wrapper.py", line 14, in get_model
model = keras.models.load_model(newest)
File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/models.py", line 240, in load_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/models.py", line 314, in model_from_config
return layer_module.deserialize(config, custom_objects=custom_objects)
File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/layers/__init__.py", line 55, in deserialize
printable_module_name='layer')
File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 140, in deserialize_keras_object
list(custom_objects.items())))
File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/engine/topology.py", line 2490, in from_config
process_layer(layer_data)
File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/engine/topology.py", line 2476, in process_layer
custom_objects=custom_objects)
File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/layers/__init__.py", line 55, in deserialize
printable_module_name='layer')
File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 140, in deserialize_keras_object
list(custom_objects.items())))
File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/layers/core.py", line 699, in from_config
function = func_load(config['function'], globs=globs)
File "/home/forrest/anaconda3/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 224, in func_load
raw_code = codecs.decode(code.encode('ascii'), 'base64')
UnicodeEncodeError: 'ascii' codec can't encode character '\xe3' in position 0: ordinal not in range(128)
The problem has been solved. Replace python36 with python35, its work. Sigh.
Is there any workaround of this error? I can not change the version of keras and python.
hi, tstandley, I have some trouble when I run your code. Can you help me?
my system environment: ubuntu 14.04 64bit python 3.6.1 (anaconda, but the package you mentioned were installed with 'pip') tensorflow 1.3.0 keras: 2.1.1
when I run the following command:
the output is:
And if run:
the output is:
This is my file tree:
This error seems to happen while reading the network model. In particular, the last called file is
/home/tstand/Dropbox/image2weight/volume_model/volume_model.py
, seems is the absolute path of this file in your computer.Can you give me some tips on how to fix this problem?