Problem with the models
rojasand opened this issue · 3 comments
Hello poke1024,
I'm trying to use origami and I installed everything, Tensorflow had to be installed in 2.2.0 because 2.1.2 is no more in conda-forge.
I downloaded the models from the dropbox link you added in the readme file and I try to do:
python -m origami.batch.detect.segment --model models/ sample_images/
this is a test to see how it works. At first the models are charged from models/v3/sep and blkx, then when trying to work on the images given i get this error:
`ERROR:root:Failed to process test_eur/1962_T2_T_1861.jpg.
Traceback (most recent call last):
File "/mnt/d/vm_shared/gits/origami/origami/batch/core/processor.py", line 411, in _trigger_process1
runtime_info = self.process(p, **kwargs)
File "/mnt/d/vm_shared/gits/origami/origami/batch/detect/segment.py", line 35, in process
segmentation = self._predictor(p)
File "/mnt/d/vm_shared/gits/origami/origami/core/segment.py", line 141, in call
return Segmentation([p(page) for p in self._predictors])
File "/mnt/d/vm_shared/gits/origami/origami/core/segment.py", line 141, in
return Segmentation([p(page) for p in self._predictors])
File "/mnt/d/vm_shared/gits/origami/origami/core/predict.py", line 348, in call
models=[p.model for p in self._predictors])
File "/mnt/d/vm_shared/gits/origami/origami/core/predict.py", line 268, in predict_for_models
pr_masks = [model.predict(tile_pixels) for model in models]
File "/mnt/d/vm_shared/gits/origami/origami/core/predict.py", line 268, in
pr_masks = [model.predict(tile_pixels) for model in models]
File "/home/alohapinilla/miniconda3/envs/origami/lib/python3.7/site-packages/keras/engine/training.py", line 1462, in predict
callbacks=callbacks)
File "/home/alohapinilla/miniconda3/envs/origami/lib/python3.7/site-packages/keras/engine/training_arrays.py", line 324, in predict_loop
batch_outs = f(ins_batch)
File "/home/alohapinilla/miniconda3/envs/origami/lib/python3.7/site-packages/tensorflow/python/keras/backend.py", line 3792, in call
outputs = self._graph_fn(*converted_inputs)
File "/home/alohapinilla/miniconda3/envs/origami/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 1605, in call
return self._call_impl(args, kwargs)
File "/home/alohapinilla/miniconda3/envs/origami/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 1645, in _call_impl
return self._call_flat(args, self.captured_inputs, cancellation_manager)
File "/home/alohapinilla/miniconda3/envs/origami/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 1746, in _call_flat
ctx, args, cancellation_manager=cancellation_manager))
File "/home/alohapinilla/miniconda3/envs/origami/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 598, in call
ctx=ctx)
File "/home/alohapinilla/miniconda3/envs/origami/lib/python3.7/site-packages/tensorflow/python/eager/execute.py", line 60, in quick_execute
inputs, attrs, num_outputs)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [3] vs. [32]
[[node model_1/stem_bn/batchnorm/mul (defined at home/alohapinilla/miniconda3/envs/origami/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:3009) ]] [Op:__inference_keras_scratch_graph_743448]
Function call stack:
keras_scratch_graph`
thanks
I assume you got this when running on a CPU, not a GPU?
Then this is a bug in Keras, I reported it here: keras-team/keras#14091
Unfortunately that issue was classified as "support", i.e. they won't fix it.
The only workaround I know of is using a GPU, which makes this whole segment step really cumbersome. I haven't tried to get it to work in Google Collab, it might work though.
Yes i'm using CPU at the moment! Ok i'll try to get my hands on a gpu and try again.
Thanks for the quick answer
edit: it worked with GPU!