Closed timothydereuse closed 1 year ago
Looking at the code I'm almost positive this is one of those python2 -> python3 issues that stems from differences in how it handles strings.
We found another error traceback. Seems like this error is going through the group_and_correct
function as opposed to the run_correction_stage
. This happens when we press group and reclassify.
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/celery/app/trace.py", line 412, in trace_task
R = retval = fun(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/celery/app/trace.py", line 704, in __protected_call__
return self.run(*args, **kwargs)
File "/code/Rodan/rodan/jobs/base.py", line 773, in run
retval = self.run_my_task(inputs, settings, arg_outputs)
File "/code/Rodan/rodan/jobs/interactive_classifier/wrapper.py", line 209, in run_my_task
features)
File "/code/Rodan/rodan/jobs/interactive_classifier/interactive_classifier.py", line 193, in group_and_correct
criterion = criterion)
File "/usr/local/lib/python3.7/site-packages/gamera/classify.py", line 141, in group_list_automatic
splits, removed = self.classify_list_automatic(glyphs)
File "/usr/local/lib/python3.7/site-packages/gamera/classify.py", line 338, in classify_list_automatic
return self._classify_list_automatic(glyphs, max_recursion, 0, progress)
File "/usr/local/lib/python3.7/site-packages/gamera/classify.py", line 292, in _classify_list_automatic
(id, conf) = self._classify_automatic_impl(glyph)
File "/usr/local/lib/python3.7/site-packages/gamera/classify.py", line 693, in _classify_automatic_impl
return self.classify_with_images(self.database, glyph)
TypeError: knn: could not get string from id_name tuple.
The first error that Gen sent happens whenever we press Reclassify.
@malajvan was able to modify the error message (finally). Here are steps:
Turns out it was the second version of this error that was causing things to break. We are going to investigate more now.
We managed to pass the error by converting the id PyObject in knnmodule.hpp (above screenshots) to PyBytes instead of strings. We are currently seeing if we can fix this from outside of the hpp and preferably outside of gamera, while also testing if that fix works. Worst case we will fix inside our gamera src code and test to make it a quick fix and see where the root of the problem is later.
Glad to see that you're making progress!
Turns out the error was from the class_name of the glyphs (i.e 'UNCLASSIFIED' etc). Gamera itself agrees with class_names being strings (as commented and implemented in the gamera python files) , but for some reason check if it's bytes in knnmodule.hpp. I'll implement a quick fix and ask the gamera people
The fix for Interactive Classifier can be found on branch IC_fix. We are attempting another fix that doesn't touch the gamera source code. If you want to run Interactive Classifier before we merge into develop, you can run rodan locally and pull the Docker images as specified in the IC_fix branch.
Just added our fix onto staging. Still waiting to hear back from the official repo but things seem to be working for now so I will close this issue.
From Gen:
When running from scratch, without any training data:
The job also fails if I ask IC to "Finalize". This is the traceback for that:
Also fails when given training data:
As far as we know, the last time it worked was last summer, possibly before the migration to Python 3.