mir-dataset-loaders / mirdata

Python library for working with Music Information Retrieval datasets

Home Page:https://mirdata.readthedocs.io/en/stable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: Object should not be empty, use None instead` when retrieving SALAMI annotations

oriolcolomefont opened this issue · comments

Hi there!
When looping and printing the iterations through the SALAMI dataset to retrieve data + annotations like this:

print(f'Iteration --> {index}', 
        f'Track data --> {salami_data[salami_ids[int(index)]]}', 
        f'JAMS annotaion --> {salami_data[salami_ids[int(index)]].to_jams()}')

the following error raises:

    199                 (
    200                     [
--> 201                         (self.sections_annotator_1_uppercase, 0),
    202                         (self.sections_annotator_1_lowercase, 1),
    203                     ],`

`[/usr/local/lib/python3.8/dist-packages/mirdata/core.py](https://localhost:8080/#) in __get__(self, obj, cls)
     44         if obj is None:
     45             return self
---> 46         value = obj.__dict__[self.func.__name__] = self.func(obj)
     47         return value
     48` 

`[/usr/local/lib/python3.8/dist-packages/mirdata/datasets/salami.py](https://localhost:8080/#) in sections_annotator_1_uppercase(self)
    162     @core.cached_property
    163     def sections_annotator_1_uppercase(self) -> Optional[annotations.SectionData]:
--> 164         return load_sections(self.sections_annotator1_uppercase_path)
    165 
    166     @core.cached_property`

`[/usr/local/lib/python3.8/dist-packages/mirdata/io.py](https://localhost:8080/#) in wrapper(file_path_or_obj)
     21         if isinstance(file_path_or_obj, str):
     22             with open(file_path_or_obj, encoding="utf-8") as f:
---> 23                 return func(f)
     24         elif isinstance(file_path_or_obj, io.StringIO):
     25             return func(file_path_or_obj)`

`[/usr/local/lib/python3.8/dist-packages/mirdata/datasets/salami.py](https://localhost:8080/#) in load_sections(fhandle)
    254     times_revised = np.delete(times, np.where(np.diff(times) == 0))
    255     secs_revised = np.delete(secs, np.where(np.diff(times) == 0))
--> 256     return annotations.SectionData(
    257         np.array([times_revised[:-1], times_revised[1:]]).T,
    258         "s",`

`[/usr/local/lib/python3.8/dist-packages/mirdata/annotations.py](https://localhost:8080/#) in __init__(self, intervals, interval_unit, labels, label_unit)
    131 
    132     def __init__(self, intervals, interval_unit, labels=None, label_unit=None):
--> 133         validate_array_like(intervals, np.ndarray, float)
    134         validate_array_like(labels, list, str, none_allowed=True)
    135         validate_lengths_equal([intervals, labels])`

`[/usr/local/lib/python3.8/dist-packages/mirdata/annotations.py](https://localhost:8080/#) in validate_array_like(array_like, expected_type, expected_dtype, none_allowed)
   1422 
   1423     if np.asarray(array_like).size == 0:
-> 1424         raise ValueError("Object should not be empty, use None instead")
   1425 
   1426 `

`ValueError: Object should not be empty, use None instead`

I have extracted many tracks' info, but in this case, it crashes, and I wonder why. Could someone please give me some light on this?

Thanks!

Hi @oriolcolomefont, thank you for reporting the issue. Can you please update the issue with more code ( what index,salami_data,salami_ids are ?) so we can look into it? And can you let us know at what index it crashes?

Apologies for the late reply! Does this work? Thanks!

Hi @oriolcolomefont, we don't have access to the link. But please share the code here itself so if people have the same issue going ahead they can refer to the same.