votchallenge / toolkit

The official VOT Challenge evaluation and analysis toolkit
http://www.votchallenge.net/
GNU General Public License v3.0
155 stars 43 forks source link

TypeError about Analysis vot2020 #25

Closed kongbia closed 1 year ago

kongbia commented 3 years ago

when I analysis the result following the official guidelines

vot analysis --workspace <workspace-path> <tracker-name> --output json

it meets a TypeError "TypeError: Object of type 'Grid' is not JSON serializable"

Can you help me to solve the problem? Thank you!

lukacu commented 3 years ago

Can you be more specific and post a track trace and some details about your system and the version of the toolkit that you have installed.

kongbia commented 3 years ago

I think it may be an encoding problem by json.dumps and have solved it by adding

class DateEnconding(json.JSONEncoder):
    def default(self, o):
        if isinstance(o, datetime.date):
            return o.strftime('%Y/%m/%d')

in vot/document/__init__.py and replace

    if serializer == "json":
        with storage.write("results.json") as handle:
            json.dump(doc, handle, indent=2)

with

    if serializer == "json":
        with storage.write("results.json") as handle:
            json.dump(doc, handle, indent=2, cls=DateEnconding)
kongbia commented 3 years ago

I used Toolkit version: 0.4.2, python 3.6, pytorch 1.3, cuda10+cudnn7 and the tracker is the official oceanplus

lukacu commented 3 years ago

Hm, yes, that may be a problem, I have not used JSON output for a long time now, apparently, a date structure was thrown in somewhere. Thanks!

lukacu commented 3 years ago

I have been working on analysis code a few days ago, but the commits are currently in dev branch. I will merge them once they are tested a bit more.