SilvioGiancola / SoccerNetv2-DevKit

Development Kit for the SoccerNet Challenge
MIT License
170 stars 39 forks source link

Annotation Tool for Actions - Remove "halves", third class requirement, Events List not adjustable, json files extra information #25

Closed Wilann closed 3 years ago

Wilann commented 3 years ago

Hi again,

I'm trying to remove the "halves" (1 or 2) in Labels-v2.json when using the Annotation Tool - I believe it has something to do with Annotation/actions/interface/main_window.py and self.half = 1

I'm also trying to remove the need for a 3rd class, specifically I don't need Annotation/actions/config/third_class.txt. It seems that something must be changed in Annotation/actions/interface/event_selection.py to allow this.

After opening my video with the tool, it seems the Events List (right side) has shrunk and can't be adjusted (see image below). Is there a way to change the code to make this adjustment possible? Screenshot from 2021-09-09 13-18-56

As always, thank you so much for taking the time to read my issue!

cioppaanthony commented 3 years ago

Hi @Wilann!

This half is used only because we have one single json file for a game, but two videos (one for each half). You may need to go through each file in the annotator and remove the if half == something. Unfortunately, I cannot give you an exhaustive list of lines since they are almost in every files and I might miss some of them. However, another simpler solution is to set it to a default value regardless of the file read. For this replace line 70 if media_player.py by self.main_window.half = int(1)

For the third class, take a look at event_selection.py, you should be able to achieve what you want by removing lines 57 to 61 and lines 69-98-99-111-122. Change also in line 100 self.list_widget_third.currentItem().text()) by a default value or remove it. This should do the trick.

For the last issue, it is maybe a problem of your screen resolution that is too low. Could you please check your screen resolution and make sure that it is at least 1920x1080 ?

Hope this helps !

Wilann commented 3 years ago

Hi @cioppaanthony,

Thanks so much for the reply!

I've made the change to /interface/media_player.py's self.main_window.half = int(1). I've potentially come across another solution - checking utils/list_management.py, there's this block of code:

for event in final_list:
    tmp_dict = dict()
    tmp_dict["gameTime"] = str(event.half) + " - " + str(event.time)
    tmp_dict["label"] = str(event.label)
    tmp_dict["team"] = str(event.team)
    tmp_dict["visibility"] = str(event.visibility)
    tmp_dict["position"] = str(event.position)
    annotations_dictionary.append(tmp_dict)

Would removing str(event.half) + " - " + from tmp_dict["gameTime"] = str(event.half) + " - " + str(event.time) be a sufficient solution?

 

Regarding event_selection.py, your instructions worked! There does seem to be another issue as a result, and its that in Labels-v2.json, now in the "annotations" list I get something like:

"gameTime": "2 - 04:15",
"label": "Coin Toss",
"position": "255075",
"team": "visible",
"visibility": "None"

As you can see, the config for "visibility", /config/second_classes.txt, is now being applied to "team". Inspecting the code, I believe changes must be made to /utils/list_management.py? (Potentially to the same block I referred to above?)

 

For the last issue, running $ xdpyinfo | grep dimensions outputs dimensions: 3440x1440 pixels (802x333 millimeters). It seems that if I stretch the window really wide, it enlarges the Events List. Please see the image below. Screenshot from 2021-09-10 10-39-54

Thank you again, and looking forward to your analysis!

Wilann commented 3 years ago

I also have a few questions regarding Labels-v2.json and Labels-cameras.json

I want to change the naming of Labels-v2.json to just Labels.json. I made all changes in the Annotation Tool I could find from "Labels-v2.json" to "Labels.json", but when opening a video it doesn't seem to load the labels. \ Specifically, in /utils/list_management.py's read_json() and save_file() and /interface/media_player.py's open_file() and get_last_label_file().

Regarding the actual json files, I noticed there's information such as:

{
    "UrlLocal": "england_epl/2014-2015/2015-02-21 - 18-00 Chelsea 1 - 1 Burnley/",
    "UrlYoutube": "",
    "gameAwayTeam": "Burnley",
    "gameDate": "21/02/2015 - 18:00",
    "gameHomeTeam": "Chelsea",
    "gameScore": "1 - 1"
}

Were these labeled manually? Also, I'm assuming they don't have any effect on training. Is there a purpose for this data?

Wilann commented 3 years ago

Update: I managed to fix all the issues, but am still wondering about this extra information in the json files:

{
    "UrlLocal": "england_epl/2014-2015/2015-02-21 - 18-00 Chelsea 1 - 1 Burnley/",
    "UrlYoutube": "",
    "gameAwayTeam": "Burnley",
    "gameDate": "21/02/2015 - 18:00",
    "gameHomeTeam": "Chelsea",
    "gameScore": "1 - 1"
}

I'm also curious about why there's a "link" in the annotations from Labels-cameras.json to Labels-v2.json . What's the purpose of this?

cioppaanthony commented 3 years ago

Hi @Wilann,

This extra information is not used in any of our applications at the moment. This is just some extra metadata about the game.

In Labels-cameras.json, this "link" information is present only if the previous camera shot was a replay of an action. The link information encodes all information about the action shown in the replay such as the action class and the timestamp of the action (which is also present in labels-v2.json).

Wilann commented 3 years ago

Hi @cioppaanthony,

Thank you for letting me know. Makes sense. Will re-open this issue if I have other questions.

ajtao commented 2 years ago

@Wilann I'm wondering if you can share any guidance for how to get labeling working for a new custom dataset? I'm trying to just run actions/src/main.py and (1) it seems to want to load a json file already even though i haven't annotated anything and (2) i haven't figured out how media_player self.path_label is supposed to get initialized, it seems like it starts out as None and then immediately is expected to be a path :). Are there a few changes to the code that you might be willing to share?

ajtao commented 2 years ago

Actually i was able to get the labeling tool running by putting a random video in one of the annotation folders and hacking the self.path_label in media_player.py to be the path of an existing label file, although i still wish i knew how this was supposed to run, the code doesn't look like it should work.

Wilann commented 2 years ago

Hi @ajtao, I believe most of the relevant changes I made were in /utils/list_management.py. I think read_json(...) needs to create an empty labels file if path doesn't exist yet, which would fix your issue:

it seems to want to load a json file already even though I haven't annotated anything

Line 65 onwards reads in the data from the labels file, depending on how you've structured it in save_file(...).

Regarding self.path_label in media_player.py, I'm not sure what that does, and didn't change it at all.

Since you plan on labeling your own dataset, I would recommend modifying all the code which uses half1 and half2 to just a single array (something like labels_list). This is what I've done - it helps to understand the code a bit better (since it's easier to read). Additionally, since I've split my sports matches into 3, this helped keep things a bit more tidy in my dataset (I just placed all 3 parts into different folders)

Hopefully this helped you a bit!

ajtao commented 2 years ago

@Wilann Very helpful, thank you! I suspected I would need to do these things but sometimes just nice to know from someone that's done similar! Was able to get up and running, thanks again.

Wilann commented 2 years ago

You're welcome! Glad I could help out :)