antemons / smart-manuscript

This software recognizes (digitizes) handwritten manuscripts and digitizer-pen input.
GNU General Public License v3.0
24 stars 5 forks source link

smartmanuscript.application crash on fresh install develop branch #2

Open marcoleewow opened 5 years ago

marcoleewow commented 5 years ago

Hi, application.py still seem to crash when doing some normalisation in preprocessing. Here is my traceback. I have installed the packages on the requirements.txt + tensor2tensor 1.5.3 which is required but not on the file.

  File "/Users/marco/smart-manuscript/smartmanuscript/application.py", line 192, in on_button_release
    self.recognize()
  File "/Users/marco/smart-manuscript/smartmanuscript/application.py", line 238, in recognize
    top_prediction, predictions, probabilities = self.recognizer.recognize_line(strokes, resort=True)
  File "/Users/marco/smart-manuscript/smartmanuscript/reader.py", line 107, in recognize_line
    features = strokes_to_features(ink, resort=resort)
  File "/Users/marco/smart-manuscript/smartmanuscript/writing.py", line 1040, in strokes_to_features
    ink, skew_is_horizontal=skew_is_horizontal)
  File "/Users/marco/smart-manuscript/smartmanuscript/writing.py", line 285, in __call__
    ink, self._normaliztion_steps(skew_is_horizontal))
  File "/Users/marco/smart-manuscript/smartmanuscript/writing.py", line 275, in _apply_normalizations
    ink, new_transformation = normalization(ink)
  File "/Users/marco/smart-manuscript/smartmanuscript/writing.py", line 420, in normalized_slant
    angle = minimize(lambda a: tilted_ink_length(ink, a), 0).x
  File "/Users/marco/.local/share/virtualenvs/pygobject-3YKUhTy8/lib/python3.7/site-packages/scipy/optimize/_minimize.py", line 594, in minimize
    return _minimize_bfgs(fun, x0, args, jac, callback, **options)
  File "/Users/marco/.local/share/virtualenvs/pygobject-3YKUhTy8/lib/python3.7/site-packages/scipy/optimize/optimize.py", line 996, in _minimize_bfgs
    gfk = myfprime(x0)
  File "/Users/marco/.local/share/virtualenvs/pygobject-3YKUhTy8/lib/python3.7/site-packages/scipy/optimize/optimize.py", line 326, in function_wrapper
    return function(*(wrapper_args + args))
  File "/Users/marco/.local/share/virtualenvs/pygobject-3YKUhTy8/lib/python3.7/site-packages/scipy/optimize/optimize.py", line 756, in approx_fprime
    return _approx_fprime_helper(xk, f, epsilon, args=args)
  File "/Users/marco/.local/share/virtualenvs/pygobject-3YKUhTy8/lib/python3.7/site-packages/scipy/optimize/optimize.py", line 690, in _approx_fprime_helper
    f0 = f(*((xk,) + args))
  File "/Users/marco/.local/share/virtualenvs/pygobject-3YKUhTy8/lib/python3.7/site-packages/scipy/optimize/optimize.py", line 326, in function_wrapper
    return function(*(wrapper_args + args))
  File "/Users/marco/smart-manuscript/smartmanuscript/writing.py", line 420, in <lambda>
    angle = minimize(lambda a: tilted_ink_length(ink, a), 0).x
  File "/Users/marco/smart-manuscript/smartmanuscript/writing.py", line 417, in tilted_ink_length
    tilted_ink = Transformation.shear(y_angle=angle) @ ink
  File "/Users/marco/smart-manuscript/smartmanuscript/writing.py", line 198, in __rmatmul__
    new_concatenated_strokes = other @ self.concatenated_strokes
  File "/Users/marco/smart-manuscript/smartmanuscript/utils.py", line 77, in __matmul__
    return other @ self.matrix[:2, :2].transpose() + self.matrix[:2, 2]
TypeError: ufunc 'matmul' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''