JonathonLuiten / TrackEval

HOTA (and other) evaluation metrics for Multi-Object Tracking (MOT).
MIT License
953 stars 232 forks source link

BUG: BURST requires `tabulate` #101

Closed davidslater closed 1 year ago

davidslater commented 1 year ago

Please add tabulate to the dependencies in requirements.txt and minimum_requirements.txt. Currently, if you import the library, you get a ModuleNotFoundError for tabulate. This in turn effects all imports of functions from the library.

Here is the stack trace:

import trackeval                                 
File "./trackeval/__init__.py", line 2, in <module>          
from . import datasets                              
File "./trackeval/datasets/__init__.py", line 9, in <module>            
from .burst import BURST                                  
File "./trackeval/datasets/burst.py", line 2, in <module>           
from .burst_helpers.burst_base import BURSTBase     
File "./trackeval/datasets/burst_helpers/burst_base.py", line 7, in <module>
from trackeval.utils import TrackEvalException      
File "./trackeval/__init__.py", line 2, in <module>          
from . import datasets                              
File "./trackeval/datasets/__init__.py", line 9, in <module>
from .burst import BURST                            
File "./trackeval/datasets/burst.py", line 3, in <module>
from .burst_helpers.format_converter import GroundTruthBURSTFormatToTAOFormatConverter, PredictionBURSTFormatToTAOFormatConverter
File "./trackeval/datasets/burst_helpers/format_converter.py", line 4, in <module>
from tabulate import tabulate
ModuleNotFoundError: No module named 'tabulate'

Alternatively, if you didn't want to modify the minimum_requirements, you will need to do one of the following (or something similar). The second solution would provide backwards compatibility and is my recommendation:

  1. not import datasets in ./trackeval/__init__.py. Not sure what issues this would cause elsewhere in the library.
  2. In ./trackeval/datasets/__init__.py, you can add a try / except block to catch this issue as follows. You can change these lines:
    from .burst import BURST
    from .burst_ow import BURST_OW

    to

    try:
    from .burst import BURST
    from .burst_ow import BURST_OW
    except ImportError as err:
    print(f"Error importing BURST due to missing underlying dependency {err}."
JonathonLuiten commented 1 year ago

Hey David.

Can you make a PR with your suggested change number 2 (and add tabulate dependency to requirements.txt but not minimum_requirements.txt), so I can simply review and accept the PR? (not easy for me to make these changes myself at the moment).

If you're free to do this right now, can be sorted very quick :)

JonathonLuiten commented 1 year ago

Also thanks!

davidslater commented 1 year ago

Yes, can do.

davidslater commented 1 year ago

Done