Giter VIP home page Giter VIP logo

clvision's Introduction

3rd CLVision Workshop @ CVPR 2022 Challenge

This is the official starting repository for the Continual Learning Challenge held in the 3rd CLVision Workshop @ CVPR 2022.

Please refer to the challenge website for more details!

The Slack channel #3rd_clvision_challenge is now open in the ContinualAI Slack: join here.

We are gathering feedback about the devkit. Join the Slack channel or open an issue directly on this repo!

Updates:

  • 07/04/2022
    • Support for the creation of a validation stream. The number of videos per class (instance or category, depending on the track) to move from the "train" to the "valid" stream can be configured as a parameter of the benchmark creation procedure.
    • Annotation 127172 (area==0) is now automatically ignored.

Getting started

This repo may be updated during the challenge to fix bugs and integrate suggestions from the community, so make sure to check it out from time to time.

The devkit is based on the Avalanche library. We warmly recommend looking at the documentation (especially the "Zero To Hero tutorials") if this is your first time using it! Avalanche is added as a Git submodule of this repository.

The recommended setup steps are as follows:

  1. Install conda (and mamba; recommended)

  2. Clone the repo and create the conda environment:

git clone --recurse-submodules https://github.com/ContinualAI/clvision-challenge-2022.git
cd clvision-challenge-2022
conda env create -f environment.yml
  1. Setup your IDE so that the avalanche submodule is included in the PYTHONPATH. Note: you have to include the top-level folder, not avalanche/avalanche!

    1. For Jetbrains IDEs (PyCharm), this can be done from the Project pane (usually on the right) by right-clicking on the "avalanche" folder -> "Mark Directory as" -> "Sources Root".
    2. For VS Code, follow the official documentation.
  2. Download and extract the dataset: in order to download the dataset, we ask all participants to accept the dataset terms and provide their email addresses through this form. You will immediately receive the download instructions at the provided address. We recommend extracting the dataset in the default folder $HOME/3rd_clvision_challenge/demo_dataset/. The final directory structure should be like this:

$HOME/3rd_clvision_challenge/challenge/
├── ego_objects_challenge_test.json
├── ego_objects_challenge_train.json
├── images
│   ├── 07A28C4666133270E9D65BAB3BCBB094_0.png
│   ├── 07A28C4666133270E9D65BAB3BCBB094_100.png
│   ├── 07A28C4666133270E9D65BAB3BCBB094_101.png
│   ├── ...

The aforementioned steps should be OS-agnostic. However, we recommend setting up your dev environment using a mainstream Linux distribution.

Object Classification (Track 1) Training Template

The starting template for the object classification track is based on the tried and tested strategies from Avalanche.

In particular, the starting template can be found in starting_template_instance_classification.py. The default template implements a working train/eval loop that uses the Naive strategy.

The Naive strategy is a plain fine-tuning loop that, given the optimizer, number of epochs, the minibatch size, and the loss function, will just run a very forgetting-prone training loop. This should be taken as the lower bound for a solution. This means that the basic loop is already there, ready to be customized. There are two main ways to implement your solution:

  • Override parts of the base class SupervisedTemplate in order to customize the epoch loop, the backward and forward operations, etcetera.
  • Implement your solution as a plugin (many mainstream techniques are implemented in Avalanche as plugins, see the documentation).

We suggest you to study the From Zero To Hero tutorials to learn about Avalanche.

Object Detection (Track 2 and 3) Training Templates

The starting point for the detection tracks are starting_template_category_detection.py and starting_template_instance_detection.py. That entry point uses the (ObjectDetectionTemplate) template, which is the template you should customize to implement your CL strategy. The recommended way to do this is to create a child class.

That training template is based on Avalanche training templates. The training loop is an almost exact implementation of the one shown in the official TorchVision Object Detection Finetuning Tutorial, especially the train_one_epoch method.

A schematic visualization of the training loop, its events, and an example of a plugin implementing EWC is shown below:

Object Detection Template schema

Submitting a solution

Solutions must be submitted through the CodaLab portal:

A solution consists of a zip file containing "N" (track-dependent) files. Each file must contain the predictions obtained on the full test set by running an eval pass after each training experience. The devkit already contains a plugin that will take care of storing such output. Make sure you do NOT include intermediate directories inside the archive. Do not change the name of files produced by the plugin.

The maximum number of allowed submissions is 20. Only 3 solutions can be submitted each day.

Note: the evaluation for detection tracks may take some minutes to complete.

Hints

  • The devkit will be updated quite often. We recommend checking if there are new updates frequently.
  • The InteractiveLogger will just print the progress to stdout (and it is quite verbose). Consider using dashboard loggers, such as Tensorboard or Weights & Biases. See the tutorial on loggers here. You can use more than one logger at the same time!

clvision's People

Contributors

lrzpellegrini avatar solangii avatar eeplearning avatar antoniocarta avatar vlomonaco avatar wbjeon2k avatar

Watchers

 avatar  avatar  avatar

clvision's Issues

avalanche benchmark

  • EgoObject Dataset Download(49기가)
  • 서버에 데이터셋 위치 공유
  • Avalanche Strategy이용 EgoDataset Benchmark 만들기

due: 04/07

naive approach

  • api에 구현된 naive strategy이용해서 기본적인 finetune으로만 학습하여 결과 확인해보기
  • model변경
  • logger 추가 (wandb, txt 저장 등)
  • strategy 변경 - ewc사용

due: 04/11

ToDo

  • HP최적화 코드 구현
  • CodaLab 사용방법
  • Dataset 정보 파악
  • 학습 테크닉 리스트업
  • 코드 baseline 정리
  • Detection으로 바꾸는 방법

code baseline 정리

  • 서버에서 작동안되는 것 해결하기
  • 실험 로그 정리 위한 작업들 (실험 이름 경로 추가, 로그에 실행시간 정보 추가, 로그 txt파일로 자동 저장)
  • 스크립트 만들기

훈련 technique

ResNet Strikes back: An improved training procedure in timm 논문에서 말하길 resnet도 최신 훈련 테크닉을 사용하면 최신 모델 결과에 밀리지 않는 결과를 낸다고 말함. 이를 위해 resnet에 사용한 훈련 테크닉들:

  1. Data Augmentation: MixUp CutMix, RandAugment등
  2. Regularization: Label smoothing, Repeated Augmentation, Stochastic Depth
  3. Optimization: LAMB, Cosine Scheduler
  4. ETC: Warmup, Mixed precision, CE-> BCE loss 등

결론은 어떤 모델을 쓰든지 간에 각 모델에 맞는 좋은 테크닉을 쓰는 것도 중요하다.

위 리스트업 된 테크닉들은 바로 적용해봐도 좋을듯함.

함수 동적 로딩 관련 작업들

입력해주는 파라미터 값에 따라 적절한 함수 호출을 위한 작업!

  • parser에 model 이름을 적어주고, 해당 모델을 호출하도록 (if/else가 아닌 모든 경우의 수에 대응 가능하게 끔)
  • parser에 사용하는 plugin 이름을 적어주고, 해당 plugin을 사용가능하도록! (마찬가지로 모든 경우의 수에 대응가능 하도록.) - 이때는 각 plugin마다 사용하는 hyper-parameter까지 전달이 잘 이뤄져야한다.
  • parser에 사용하는 strategy이름을 적어주고 해당 strategy를 사용가능하도록

hyper-parameter tuning

  • ray tune, wandb sweep 등을 활용하여 hyper-parameter 최적화 과정 코드 추가하기

[Todo] Advanced Augmentation

Classification

...
dataset = datasets.CIFAR100(args.cifarpath, train=True, download=True, transform=transform_train)
dataset = CutMix(dataset, num_class=100, beta=1.0, prob=0.5, num_mix=2)    # this is paper's original setting for cifar.
...

이런식으로 pytorch.dataset에 cutmix 적용할 수 있음. 우리의 benchmark에도 적용이 가능할지는?🤷‍♀️(해봐야안다)

Detection

  • bounding box에도 적용가능하도록 변경해야함
  • 적용해볼 수 있는 reference 수집하고 시도해보기 - avalanche와 관련된 이슈라면 더 좋음

classification code update

  • lr 스케쥴러, plugin 사용 추가
  • hyper param update - 새로운 스크립트 제작
  • learning rate 분리 (pretrain network사용으로 classifier의 lr이 더 높게)
  • validation stream 파라미터 추가

Detection TODO

  • Optuna function call 확인
  • Optuna 튜닝 코드/옵션 추가
  • train/test AP Metric 확인
  • Validation Evaluation에서 experience마다 adaption "before","after" 2번씩 측정하는 것 줄일 수 있는지 (시간단축)

몇 가지 추가 (2022.05.13)

  • 플로그인 적용 (ewc, replay 기타 등등)
  • (좀 어렵겟지만) augmentation
  • validation에서 checkpoint 저장하고 사용하는 것 적용

Dataset normalize value

dataset normalize value를 정확하게 구해보자. (현재는 imagenet 기반 value가 default로 사용되고 있음)

def get_mean_and_std(dataloader):
    channels_sum, channels_squared_sum, num_batches = 0, 0, 0
    for data, _ in dataloader:
        # Mean over batch, height and width, but not over the channels
        channels_sum += torch.mean(data, dim=[0,2,3])
        channels_squared_sum += torch.mean(data**2, dim=[0,2,3])
        num_batches += 1
    
    mean = channels_sum / num_batches

    # std = sqrt(E[X^2] - (E[X])^2)
    std = (channels_squared_sum / num_batches - mean ** 2) ** 0.5

    return mean, std

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.