toolkit icon indicating copy to clipboard operation
toolkit copied to clipboard

TypeError about Analysis vot2020

Open kongbia opened this issue 4 years ago • 5 comments

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!

kongbia avatar Nov 06 '20 14:11 kongbia

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.

lukacu avatar Nov 08 '20 07:11 lukacu

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 avatar Nov 09 '20 04:11 kongbia

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

kongbia avatar Nov 09 '20 04:11 kongbia

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 avatar Nov 12 '20 12:11 lukacu

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.

lukacu avatar Dec 04 '20 15:12 lukacu