Skip to content

Conversation

@bertsky
Copy link
Collaborator

@bertsky bertsky commented Dec 10, 2025

builds on OCR-D/core#1344

simply run with 2 output file groups, e.g. ocrd-anybaseocr-crop -I OCR-D-IMG -O OCR-D-CROP-L,OCR-D-CROP-R

- allow `output_file_grp` to be 2-valued (comma-separated)
- in split mode, for edge-based detection, also search for
  large vertical line in the middle
- in split mode, for text box-based detection, allow up to
  2 largest columns to survive
- in split mode, if 2 page frames have been detected, then
  the 2nd border goes to a deepcopy of the input PcGts, and
  both results go to a single `OcrdPageResult` in list
  semantics (with 2 different `OcrdPageResultImage`s for
  the respective cropped alternative image)
- in split mode, if no 2nd border candidate could be
  found, just omit the second group/output
@bertsky bertsky requested a review from kba December 10, 2025 21:47
@bertsky
Copy link
Collaborator Author

bertsky commented Dec 11, 2025

builds on OCR-D/core#1344

hence the CI's failure

TypeError: 'OcrdPageResult' object is not iterable

(we have to wait for this to be merged and released on PyPI)

But what has me worried is the failure of the layout-analysis test:

File "/home/circleci/repo/src/ocrd_anybaseocr/cli/ocrd_anybaseocr_layout_analysis.py", line 116, in _predict
    pred = self.model.predict(img_array)
  File "/home/circleci/.pyenv/versions/3.8.20/lib/python3.8/site-packages/keras/engine/training_v1.py", line 1059, in predict
    return func.predict(
  File "/home/circleci/.pyenv/versions/3.8.20/lib/python3.8/site-packages/keras/engine/training_arrays_v1.py", line 801, in predict
    return predict_loop(
  File "/home/circleci/.pyenv/versions/3.8.20/lib/python3.8/site-packages/keras/engine/training_arrays_v1.py", line 192, in model_iteration
    f = _make_execution_function(model, mode)
  File "/home/circleci/.pyenv/versions/3.8.20/lib/python3.8/site-packages/keras/engine/training_arrays_v1.py", line 620, in _make_execution_function
    return model._make_execution_function(mode)
  File "/home/circleci/.pyenv/versions/3.8.20/lib/python3.8/site-packages/keras/engine/training_v1.py", line 2372, in _make_execution_function
    self._make_predict_function()
  File "/home/circleci/.pyenv/versions/3.8.20/lib/python3.8/site-packages/keras/engine/training_v1.py", line 2356, in _make_predict_function
    self.predict_function = backend.function(
  File "/home/circleci/.pyenv/versions/3.8.20/lib/python3.8/site-packages/keras/backend.py", line 4677, in function
    return GraphExecutionFunction(
  File "/home/circleci/.pyenv/versions/3.8.20/lib/python3.8/site-packages/keras/backend.py", line 4448, in __init__
    with tf.control_dependencies([self.outputs[0]]):
  File "/home/circleci/.pyenv/versions/3.8.20/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 5698, in control_dependencies
    return get_default_graph().control_dependencies(control_inputs)
  File "/home/circleci/.pyenv/versions/3.8.20/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 5107, in control_dependencies
    c = self.as_graph_element(c)
  File "/home/circleci/.pyenv/versions/3.8.20/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 4012, in as_graph_element
    return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
  File "/home/circleci/.pyenv/versions/3.8.20/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 4091, in _as_graph_element_locked
    raise ValueError("Tensor %s is not an element of this graph." % obj)
ValueError: Tensor Tensor("dense_2/Sigmoid:0", shape=(?, 1), dtype=float32) is not an element of this graph.

We don't do much more than tensorflow.keras.models.load_model and then .predict() – in the same process and thread. The only change to earlier might be the upstream versions (although we already required keras < 3.0 and tensorflow < 2.16 before)...

@bertsky
Copy link
Collaborator Author

bertsky commented Dec 11, 2025

The only change to earlier might be the upstream versions (although we already required keras < 3.0 and tensorflow < 2.16 before)...

But all Python versions fail the same (regardless of which TF and Keras is available).

in the same process and thread

Maybe not the same thread – since OCR-D/core@3cc4780 we use a ThreadPool for our page timeout...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant