Giter Site home page Giter Site logo

Each file contains the images for K shots for a specific category. There may be more instances in the images than K; in these cases, we randomly sample K instances. about fsce HOT 14 CLOSED

megvii-research avatar megvii-research commented on September 25, 2024
Each file contains the images for K shots for a specific category. There may be more instances in the images than K; in these cases, we randomly sample K instances.

from fsce.

Comments (14)

Chen-Song avatar Chen-Song commented on September 25, 2024

Excuse me, where did you randomly sample k instances in your code?

from fsce.

Chauncy-Cai avatar Chauncy-Cai commented on September 25, 2024

(1)For a K-shot task, we can only get K instances of novel classes for training or finetune. If there are two 'chair' in a image, but we only need 1 shot. We will randomly choose one of them instead of both of them.
(2)Sampling k instances randomly should be done before training, you can run "prepare_[coco,voc,lvis]_few_shot.py" file in "FSCE/datasets/" to generate random k instances. After that, you should change your yaml to figure out which training dataset will be used.

from fsce.

Chen-Song avatar Chen-Song commented on September 25, 2024

Thanks for your reply. I run prepare_voc_few_shot.py and find there are more instances than the pre-defined k. For example, in "http://dl.yf.io/fs-det/datasets/vocsplit/seed1/box_10shot_sheep_train.txt", there are seven images while these images contain 24 'sheep' instances.

from fsce.

Chen-Song avatar Chen-Song commented on September 25, 2024

In 'http://dl.yf.io/fs-det/datasets/vocsplit/seed1/box_5shot_tvmonitor_train.txt', there are four images while these images contain six 'tvmonitor' instances. Maybe there is some important information that I have overlooked or I have a wrong understanding of these generated files. Look forward to your reply.

from fsce.

Retiina avatar Retiina commented on September 25, 2024

ucbdrive/few-shot-object-detection#89

Though a single process load exact k shot, since the seed is not fixed over different rank, different processes may select different k shot which results the overall shot is higher than the expected k.

from fsce.

Chen-Song avatar Chen-Song commented on September 25, 2024

Thanks, “Is this expected behavior or a bug?”

from fsce.

Chauncy-Cai avatar Chauncy-Cai commented on September 25, 2024

I think it's expected behavior. When you run train_net, you should see a chart, which will tell you the number of instances from every class.

from fsce.

john2020-210 avatar john2020-210 commented on September 25, 2024

where can I find the configs file in the model_zoo ,as it is a soft link in the source file

from fsce.

Chauncy-Cai avatar Chauncy-Cai commented on September 25, 2024

@john2020-210 It's the output of the build operation. Please delete it, or the build operation may not succeed.

from fsce.

john2020-210 avatar john2020-210 commented on September 25, 2024

@Chauncy-Cai Thank you for your reply

from fsce.

bsun0802 avatar bsun0802 commented on September 25, 2024

Thanks for your reply. I run prepare_voc_few_shot.py and find there are more instances than the pre-defined k. For example, in "http://dl.yf.io/fs-det/datasets/vocsplit/seed1/box_10shot_sheep_train.txt", there are seven images while these images contain 24 'sheep' instances.

@Chen-Song The K-shot preparation comes from fsdet. We inspected the instances and have same concern with you. I also noticed fsdet dataloader load 1 instance per image, and ignoring all other annotations. Maybe that's their definition of "few-shot object detection". And actually, we are working on improving the sampling for K-shot, and change the data loader in our v2.
Too much details to discuss here. E.g., what to do when you already have 9-shot, and you sample an image with 4 sheeps.
Or, what to do with the novel instances during base training. I found in the base training stage, the "base images" even contains more (ignored) novel instances than base instances, because common class like person is novel and are so universal.

We encourage you to do your own research, and formulate your own K-shot sampling schema.

from fsce.

Retiina avatar Retiina commented on September 25, 2024

@bsun0802 I think it is a bug. If we fix seed before random choice, see here:

https://github.com/MegviiDetection/FSCE/blob/94ba3f4737d5e40af795db49b8c6914526c912b6/fsdet/data/datasets/meta_pascal_voc.py#L129-L130

In DDP training different processes may select different instances though the number of instances of a single process is exact K. This is unfair when comparing other method which use exact K shot for training.
If we fix the seed, say np.random.seed(seed) before random_choice, then each process will select exactly the same instances and the number of overall instances is exact K. The performance will drop a lot.

from fsce.

bsun0802 avatar bsun0802 commented on September 25, 2024

This code is from fsdet unchanged.

I have a different understanding than yours @Retiina . And I don't think the problem you mention exists, based on my experience. Here is mine:

In my understanding and experience with detectron2, meta_pascal_voc.py is used for registering the dataset. Which is executed on 1 cpu and executed only once for any training job, before any model training (DDP) code. This step register which exact K-shot to be used as the training data. And the actual data loader is in the function build_detection_train_loader.

from fsce.

Retiina avatar Retiina commented on September 25, 2024

@bsun0802 Thanks for your reply. I think you are right.

from fsce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.