facebookresearch / facebookresearch/SlowFast

training custom dataset with number of categories below 5 leads to error in topk calculation

Open
#316 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Hi

Just wanted to share a very small issue with this awesome framework...

In the case when you are training on a custom dataset where the number of classes is below 5 (in my case, I have only 3 classes for instance in my dataset), then the training script issues an error during the computation of the topk scores, as it expects by default to have at least 5 classes (not a problem indeed when you are dealing with 400 classes like in the case of Kinetics)

It seems to be hardcoded in train_net.py

`num_topks_correct = metrics.topks_correct(preds, labels, (1, 5))`

I had to change it as (1,3) for my specific case as we have only 3 categories

`num_topks_correct = metrics.topks_correct(preds, labels, (1, 3))`

Same in fact for the test script

`test_meter.finalize_metrics()` needs to be replaced for my case with `test_meter.finalize_metrics(ks=(1,3))`

Is there another good way to do this, or would it be maybe possible to set this parameter instead in the configuration file directly ? Maybe I missed something

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.