Dataset import fails (h-cls dataset, Datumaro v1) with unclear message
The same steps as in #5805
- Prepare a datumaro dataset exported in Geti Classic for hierarchical classification.
- Create a multi-label classification project. Add one label.
- Import the dataset.
The import fails. UI shows a nasty exception instead of a nice error message. If hierarchical classification is not supported, I'd expect a more user friendly error. Backend shows:
File "/application/backend/.venv/lib/python3.13/site-packages/datumaro/experimental/dataset.py", line 510, in __getitem__
direct_attributes[key] = attr_info.field.from_polars(key, 0, row_df, attr_info.type)
│ │ │ │ │ │ │ │ └ <class 'int'>
│ │ │ │ │ │ │ └ AttributeInfo(type=<class 'int'>, field=LabelField(semantic='default', dtype=UInt8, multi_label=False, is_list=True), categor...
│ │ │ │ │ │ └ shape: (1, 4)
│ │ │ │ │ │ ┌─────────────┬─────────┬──────────┬─────────────────────────────────┐
│ │ │ │ │ │ │ image_info ┆ subset ┆ label ┆ ima...
│ │ │ │ │ └ 'label'
│ │ │ │ └ <function LabelField.from_polars at 0x769e21c75080>
│ │ │ └ LabelField(semantic='default', dtype=UInt8, multi_label=False, is_list=True)
│ │ └ AttributeInfo(type=<class 'int'>, field=LabelField(semantic='default', dtype=UInt8, multi_label=False, is_list=True), categor...
│ └ 'label'
└ {'image_path': '/application/data/staged_datasets/45a51860-2a24-40a6-bc1d-d9458d734768/dataset/images/image_path_000000.jpg',...
File "/application/backend/.venv/lib/python3.13/site-packages/datumaro/experimental/fields/annotations.py", line 253, in from_polars
return from_polars_data(data, target_type)
│ │ └ <class 'int'>
│ └ shape: (1,)
│ Series: '' [u8]
│ [
│ 4
│ ]
└ <function from_polars_data at 0x769fbee58b80>
File "/application/backend/.venv/lib/python3.13/site-packages/datumaro/experimental/type_registry.py", line 263, in from_polars_data
return _from_polars_converters[target_type](polars_data)
│ │ └ shape: (1,)
│ │ Series: '' [u8]
│ │ [
│ │ 4
│ │ ]
│ └ <class 'int'>
└ {<class 'numpy.ndarray'>: <function <lambda> at 0x769fbee58540>, <class 'int'>: <function <lambda> at 0x769fbee585e0>, <class...
File "/application/backend/.venv/lib/python3.13/site-packages/datumaro/experimental/type_registry.py", line 109, in <lambda>
int: lambda x: int(x),
│ └ shape: (1,)
│ Series: '' [u8]
│ [
│ 4
│ ]
└ shape: (1,)
Series: '' [u8]
[
4
]
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'Series'
@itallix please check if it's still reproducible after the recent fixes. Note that the expectation of this ticket is:
If hierarchical classification is not supported, I'd expect a more user friendly error.
@itallix please check if it's still reproducible after the recent fixes. Note that the expectation of this ticket is:
If hierarchical classification is not supported, I'd expect a more user friendly error.
prepare_dataset_for_import job completes successfully, however iteration through dataset samples with for item in dataset to count annotations is not working. The error mentioned above still persists:
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'Series'
I have managed to reproduce it with cards dataset when using experimental api for import:
from datumaro.experimental import import_dataset
dd = import_dataset("hierarchical-cards-classification-imported-dataset-dataset.zip")
dd[0]
I will look into this today. The legacy datumaro to the new datumaro format conversion has a check to see if the imported dataset is a hierarchical classification dataset but this is not always easily identifiable. I don't think we can support import of hierarchical classification datasets if we want to have a feature freeze this Friday.
I don't think we can support import of hierarchical classification datasets if we want to have a feature freeze this Friday.
We don't need to support h-cls dataset, only validate against them with a proper error message, if possible. See my comment above
I don't think we can support import of hierarchical classification datasets if we want to have a feature freeze this Friday.
We don't need to support h-cls dataset, only validate against them with a proper error message, if possible. See my comment above
@AlbertvanHouten In that case, throwing ValueError similar to incorrect format from import_dataset will solve the issue
@leoll2 The latest code. When trying to import, I am getting a "red" error message "An error occurred during import. The dataset with hierarchical labels is not supported.", which should be enough. Unfortunately, I am still getting this nasty
Traceback (most recent call last): File "/application/backend/app/core/jobs/exec/process_run.py", line 149, in _entrypoint runnable.run(ExecutionContext(payload=payload, report=report)) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/application/backend/app/execution/base.py", line 92, in run self.execute(self.parse_params(ctx)) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ File "/application/backend/app/execution/dataset_import/prepare.py", line 90, in execute tmp_dir = self.convert_archive(archive_path) File "/application/backend/app/execution/base.py", line 41, in wrapper result = func(self, *args, **kwargs) File "/application/backend/app/execution/dataset_import/prepare.py", line 78, in convert_archive raise ExecutionErr(self.HIERARCHICAL_LABELS_ERR) app.execution.base.ExecutionErr: The dataset with hierarchical labels is not supported.
in the UI.
From the backend perspective, error feedback for jobs is currently provided via the error and message attributes of the job payload, where:
erroralways contains a tracebackmessagecontains user-friendly text, in this case:The dataset with hierarchical labels is not supported.
The UX currently shows both:
I think we should update the UX to avoid overwhelming users with overly verbose feedback. @jpggvilaca @dwesolow what do you think about hiding the traceback behind an info button within the error alert?
From the backend perspective, error feedback for jobs is currently provided via the
errorandmessageattributes of the job payload, where:
erroralways contains a tracebackmessagecontains user-friendly text, in this case:The dataset with hierarchical labels is not supported.The UX currently shows both:
I think we should update the UX to avoid overwhelming users with overly verbose feedback. [@jpggvilaca](https://github.com/jpggvilaca) [@dwesolow](https://github.com/dwesolow) what do you think about hiding the traceback behind an info button within the error alert?
Is traceback useful for the user? If no we can just show The dataset with hierarchical labels is not supported. and hide the section with traceback. If the traceback is necessary then showing that behind this icon might be good enough.
.
Bonus: Red error notification should not be displayed since the same error information is already displayed in the import dataset banner. @camiloHimura wdyt?
If the traceback is necessary then showing that behind this icon might be good enough.
It might be valuable in situations when alert message is too generic, e.g. Failed: <step name>
@dwesolow Tracebacks are useful, however the UI shouldn't show them by default in the main page because it looks ugly and "intimidating" for inexperienced users. I suggest you to display message by default (i.e. the user-friendly error), with an option "Technical details" to expand/collapse the traceback in error.
I think we should update the UX to avoid overwhelming users with overly verbose feedback. [@jpggvilaca](https://github.com/jpggvilaca) [@dwesolow](https://github.com/dwesolow) what do you think about hiding the traceback behind an info button within the error alert?