Codebase for Image Classification Research, written in PyTorch.

Related tags

Deep Learningpycls
Overview

pycls

pycls is an image classification codebase, written in PyTorch. It was originally developed for the On Network Design Spaces for Visual Recognition project. pycls has since matured and been adopted by a number of projects at Facebook AI Research.

pycls provides a large set of baseline models across a wide range of flop regimes.

Introduction

The goal of pycls is to provide a simple and flexible codebase for image classification. It is designed to support rapid implementation and evaluation of research ideas. pycls also provides a large collection of baseline results (Model Zoo). The codebase supports efficient single-machine multi-gpu training, powered by the PyTorch distributed package, and provides implementations of standard models including ResNet, ResNeXt, EfficientNet, and RegNet.

Using pycls

Please see GETTING_STARTED for brief installation instructions and basic usage examples.

Model Zoo

We provide a large set of baseline results and pretrained models available for download in the pycls Model Zoo; including the simple, fast, and effective RegNet models that we hope can serve as solid baselines across a wide range of flop regimes.

Sweep Code

The pycls codebase now provides powerful support for studying design spaces and more generally population statistics of models as introduced in On Network Design Spaces for Visual Recognition and Designing Network Design Spaces. This idea is that instead of planning a single pycls job (e.g., testing a specific model configuration), one can study the behavior of an entire population of models. This allows for quite powerful and succinct experimental design, and elevates the study of individual model behavior to the study of the behavior of model populations. Please see SWEEP_INFO for details.

Projects

A number of projects at FAIR have been built on top of pycls:

If you are using pycls in your research and would like to include your project here, please let us know or send a PR.

Citing pycls

If you find pycls helpful in your research or refer to the baseline results in the Model Zoo, please consider citing an appropriate subset of the following papers:

@InProceedings{Radosavovic2019,
  title = {On Network Design Spaces for Visual Recognition},
  author = {Ilija Radosavovic and Justin Johnson and Saining Xie Wan-Yen Lo and Piotr Doll{\'a}r},
  booktitle = {ICCV},
  year = {2019}
}

@InProceedings{Radosavovic2020,
  title = {Designing Network Design Spaces},
  author = {Ilija Radosavovic and Raj Prateek Kosaraju and Ross Girshick and Kaiming He and Piotr Doll{\'a}r},
  booktitle = {CVPR},
  year = {2020}
}

@InProceedings{Dollar2021,
  title = {Fast and Accurate Model Scaling},
  author = {Piotr Doll{\'a}r and Mannat Singh and Ross Girshick},
  booktitle = {CVPR},
  year = {2021}
}

License

pycls is released under the MIT license. Please see the LICENSE file for more information.

Contributing

We actively welcome your pull requests! Please see CONTRIBUTING.md and CODE_OF_CONDUCT.md for more info.

Comments
  • time_model.py gives different results to those in model_zoo

    time_model.py gives different results to those in model_zoo

    Hi - I appreciate there's already an open issue related to speed, but mine is slightly different.

    When I run python tools/time_net.py --cfg configs/dds_baselines/regnetx/RegNetX-1.6GF_dds_8gpu.yaml having changed GPUS: from 8 to 1, I get the following dump. I am running this on a batch of size 64, with input resolution 224x224, on a V100, as stated in the paper.

    image This implies a forward pass of ~62ms, not the 33ms stated in MODEL_ZOO. Have I done something wrong? Not sure why the times are so different. The other numbers (acts, params, flops) all seem fine. The latency differences are seen for other models as well - here is 800MF (39ms vs model zoo's 21ms): image

    I am using commit a492b56f580d43fb4e003eabda4373b25b4bedec, not the latest version of the repo, but MODEL_ZOO has not been changed since before this commit. This is because it is useful being able to time the models on dummy data, rather than having to construct a dataset. Would it be possible to have an option to do this? I can open a separate issue as a feature request for consideration if necessary.

    opened by Ushk 9
  • would you tell us how to prepare imagenet dataset?

    would you tell us how to prepare imagenet dataset?

    Hi, After going through the code, I noticed this line: https://github.com/facebookresearch/pycls/blob/cd1cfb185ab5ebef328e2c3a38f68112bbd43712/pycls/datasets/imagenet.py#L55

    It seems that the imagenet val dataset does not have images stored in different subdirectories as does with train set. Why is the dataset implement like this? Would you please tell us how to prepare the imagenet dataset so that we could reproduce the result in the model zoo?

    opened by CoinCheung 6
  • Use model without Internet access

    Use model without Internet access

    Is it possible to use pycls models without Internet access? I'm using pretrained=False parameter and load weights manually, but I'm still getting URLError: <urlopen error [Errno -3] Temporary failure in name resolution>.

    opened by atamazian 5
  • add test_net.py

    add test_net.py

    Adding test_net.py to evaluate a trained model. Example command:

    python tools/test_net.py \
        --cfg configs/baselines/imagenet/R-50-1x64d_bs32_1gpu.yaml \
        TRAIN.START_CHECKPOINT save/resnet50/checkpoints/model_epoch_0096.pyth \
        TEST.BATCH_SIZE 256
    

    I wonder if we want to import duplicated functions from train.py or not. I isolate them for now.

    CLA Signed Merged 
    opened by felixgwu 5
  • question about ema alpha setting

    question about ema alpha setting

    Hi, thanks for your wonderful repo. In your code of update_model_ema https://github.com/facebookresearch/pycls/blob/ee770af5b55cd1959e71af73bf9d5b7d7ac10dc3/pycls/core/net.py#L101-L114

    I notice that you are using a magic code adjust = cfg.TRAIN.BATCH_SIZE / cfg.OPTIM.MAX_EPOCH * update_period to modify alpha value. Is there any insight of doing this? If there are some paper of this, could you please help telling me?

    Thanks : )

    opened by FateScript 4
  • Sweep code for studying model population stats (1 of 2)

    Sweep code for studying model population stats (1 of 2)

    This is a major update and introduces powerful new functionality to pycls.

    The pycls codebase now provides powerful support for studying design spaces and more generally population statistics of models as introduced in On Network Design Spaces for Visual Recognition and Designing Network Design Spaces. This idea is that instead of planning a single pycls job (e.g., testing a specific model configuration), one can study the behavior of an entire population of models. This allows for quite powerful and succinct experimental design, and elevates the study of individual model behavior to the study of the behavior of model populations. Please see SWEEP_INFO for details.

    This is commit 1 of 2 for the sweep code. It is focused on the sweep config, setting up the sweep, and launching it.

    Co-authored-by: Raj Prateek Kosaraju [email protected] Co-authored-by: Piotr Dollar [email protected]

    CLA Signed Merged 
    opened by rajprateek 4
  • Sweep code for studying model population stats

    Sweep code for studying model population stats

    This is a major update and introduces powerful new functionality to pycls.

    The pycls codebase now provides powerful support for studying design spaces and more generally population statistics of models as introduced in On Network Design Spaces for Visual Recognition and Designing Network Design Spaces. This idea is that instead of planning a single pycls job (e.g., testing a specific model configuration), one can study the behavior of an entire population of models. This allows for quite powerful and succinct experimental design, and elevates the study of individual model behavior to the study of the behavior of model populations. Please see SWEEP_INFO for details.

    CLA Signed 
    opened by theschnitz 4
  • Exponential Moving Average of Weights (EMA)

    Exponential Moving Average of Weights (EMA)

    EMA as used in "Fast and Accurate Model Scaling" to improve accuracy. Note that EMA of model weights is nearly free computationally (if not computed every iter), hence EMA weights area always computed/stored. Saving/loading checkpoints has been updated, but the code is backward compatible with checkpoints that do not store the ema weights.

    Details: -config.py: added EMA options -meters.py: generalized to allow for ema meter -net.py: added update_model_ema() to compute model ema -trainer.py: added updating/testing/logging of ema model -checkpoint.py: save/load_checkpoint() also save/load ema weights

    CLA Signed Merged 
    opened by pdollar 4
  • Model scaling in

    Model scaling in "Fast and Accurate Model Scaling"

    See GETTING_STARTED.md for example usage.

    Summary: -paper reference: https://arxiv.org/abs/2103.06877 -regnet.py: added regnet_cfg_to_anynet_cfg() -scaler.py: implements model scaler -scale_net.py: entry point for model scaler -GETTING_STARTED.md: added example usage for scaler

    CLA Signed Merged 
    opened by pdollar 4
  • Plan to support the design space comparison

    Plan to support the design space comparison

    Hi @rajprateek , @ir413 , Thanks for your team's great work, it provides many insights to the community. I am sure that the model zoos and the current codebase could inspire future research a lot.

    I am also a little bit curious about the future plans of your codebase. So I want to ask that do you have any plans to support the design space comparison in this repo? For example, to allow users to sample & train models from different design spaces and compare these design spaces as described in the Sec. 3.1, as shown in Fig. 5, 7, and 9 in the paper. I think this feature could help the community to reproduce the comparison process and further improve this codebase's impact.

    enhancement 
    opened by ZwwWayne 4
  • How to sample models for Figure 11 in RegNet paper

    How to sample models for Figure 11 in RegNet paper

    Hi, I noticed that 100 models are sampled to get the results as shown in Figure 11. (sec 4).

    However, as the flops in the figure span a wide range(0.2B~12.8B), I don't know whether

    the total number of models in all the flops regime is 100, or

    for each of the flops regime, you sampled 100 models?

    opened by ShoufaChen 4
  • RuntimeError: Cannot re-initialize CUDA in forked subprocess.

    RuntimeError: Cannot re-initialize CUDA in forked subprocess.

    RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method

    how to solve this problem?

    an answer says: torch.multiprocessing.set_start_method('spawn') but where to add this line?

    opened by pustar 1
  • Integration of other data types

    Integration of other data types

    Does this framework support the integration of other data types? i.e if I want to input data other than images, can I easily extend the framework to do this?

    opened by mdanb 0
  • url download error

    url download error

    device env: win10 py3.8 found in my env, when downloading yaml and pyth, raise "urllib.error.HTTPError: HTTP Error 404: Not Found",

    it turned out that when concat url,

    config_url = os.path.join(_URL_CONFIGS, _MODEL_ZOO_CONFIGS[name])

    the sep added in the url in windows is '', which cause this error,

    to solve in my env: config_url = _URL_CONFIGS + '/ + _MODEL_ZOO_CONFIGS[name] or as implemented in https://stackoverflow.com/questions/8223939/how-to-join-absolute-and-relative-urls

    opened by jjxyai 0
  • How to Pick Best Model in RegNetX?

    How to Pick Best Model in RegNetX?

    Hi, in regnet, the paper[1] mentioned it picks the best model of 25 random models (Section 5) as the final result. However, I cannot find the relative setting to train these 25 random models. Is that used the same setting to get EDF, showed in Figure.9 ?

    [1] https://arxiv.org/pdf/2003.13678.pdf

    opened by LicharYuan 0
Releases(0.2)
  • 0.2(May 21, 2021)

    This is a major update and introduces powerful new functionality to pycls.

    The pycls codebase now provides powerful support for studying design spaces and more generally population statistics of models as introduced in On Network Design Spaces for Visual Recognition and Designing Network Design Spaces. This idea is that instead of planning a single pycls job (e.g., testing a specific model configuration), one can study the behavior of an entire population of models. This allows for quite powerful and succinct experimental design, and elevates the study of individual model behavior to the study of the behavior of model populations. Please see SWEEP_INFO for details.

    This code was co-authored by Piotr Dollar (@pdollar) and Raj Prateek Kosaraju (@rajprateek).

    Source code(tar.gz)
    Source code(zip)
  • 0.1(Apr 15, 2020)

    We have added a large set of baseline results and pretrained models available for download in the pycls Model Zoo; including the simple, fast, and effective RegNet models that we hope can serve as solid baselines across a wide range of flop regimes.

    New features included in this release:

    • Cache model weight URLs provided in configs locally | 4e470e21ad55aff941f1098666f70ef982626f7a
    • Allow optional weight decay fine-tuning for BN params, changes the default BN weight decay | 4e470e21ad55aff941f1098666f70ef982626f7a
    • Support Squeeze & Excitation in AnyNet | ec188632fab607a41bff1a63c7ac9bd0d949bb52
    • RegNet model abstraction | 4f5b5dafe4f4274f7cba774923b8d1ba81d9904c, 708d429e67b1a43dfd7e22cb754ecaaf234ba308, 24a2805f1040787a047ed0339925adf98109e64c
    • Run precise time in test_net and count acts for a model | ad01b81c516e59e134bfde22ab827aa61744b83c

    Other changes:

    • Updated README | 4acac2b06945f6b0722f20748e2104bd6a771468
    • New Model Zoo | 4acac2b06945f6b0722f20748e2104bd6a771468, 4f5b5dafe4f4274f7cba774923b8d1ba81d9904c
    • New configs for models from Designing Network Design Spaces paper | 44bcfa71ebd7b9cd8e81f4d28ce319e814cbbb73, e9c1ef4583ef089c182dd7fe9823db063a4909e3
    Source code(tar.gz)
    Source code(zip)
Owner
Facebook Research
Facebook Research
A large-scale benchmark for co-optimizing the design and control of soft robots, as seen in NeurIPS 2021.

Evolution Gym A large-scale benchmark for co-optimizing the design and control of soft robots. As seen in Evolution Gym: A Large-Scale Benchmark for E

121 Dec 14, 2022
Degree-Quant: Quantization-Aware Training for Graph Neural Networks.

Degree-Quant This repo provides a clean re-implementation of the code associated with the paper Degree-Quant: Quantization-Aware Training for Graph Ne

35 Oct 07, 2022
这是一个yolox-keras的源码,可以用于训练自己的模型。

YOLOX:You Only Look Once目标检测模型在Keras当中的实现 目录 性能情况 Performance 实现的内容 Achievement 所需环境 Environment 小技巧的设置 TricksSet 文件下载 Download 训练步骤 How2train 预测步骤 Ho

Bubbliiiing 64 Nov 10, 2022
DNA-RECON { Automatic Web Reconnaissance Tool }

ABOUT TOOL : DNA-RECON is an automatic web reconnaissance tool written in python. This tool made for reconnaissance and information gathering with an

NIKUNJ BHATT 25 Aug 11, 2021
Solving Zero-Shot Learning in Named Entity Recognition with Common Sense Knowledge

Zero-Shot Learning in Named Entity Recognition with Common Sense Knowledge Associated code for the paper Zero-Shot Learning in Named Entity Recognitio

Søren Hougaard Mulvad 13 Dec 25, 2022
DeconvNet : Learning Deconvolution Network for Semantic Segmentation

DeconvNet: Learning Deconvolution Network for Semantic Segmentation Created by Hyeonwoo Noh, Seunghoon Hong and Bohyung Han at POSTECH Acknowledgement

Hyeonwoo Noh 325 Oct 20, 2022
Processed, version controlled history of Minecraft's generated data and assets

mcmeta Processed, version controlled history of Minecraft's generated data and assets Repository structure Each of the following branches has a commit

Misode 75 Dec 28, 2022
Jax/Flax implementation of Variational-DiffWave.

jax-variational-diffwave Jax/Flax implementation of Variational-DiffWave. (Zhifeng Kong et al., 2020, Diederik P. Kingma et al., 2021.) DiffWave with

YoungJoong Kim 37 Dec 16, 2022
[ICML 2020] DrRepair: Learning to Repair Programs from Error Messages

DrRepair: Learning to Repair Programs from Error Messages This repo provides the source code & data of our paper: Graph-based, Self-Supervised Program

Michihiro Yasunaga 155 Jan 08, 2023
Official PyTorch Implementation of paper EAN: Event Adaptive Network for Efficient Action Recognition

Official PyTorch Implementation of paper EAN: Event Adaptive Network for Efficient Action Recognition

TianYuan 27 Nov 07, 2022
Generic image compressor for machine learning. Pytorch code for our paper "Lossy compression for lossless prediction".

Lossy Compression for Lossless Prediction Using: Training: This repostiory contains our implementation of the paper: Lossy Compression for Lossless Pr

Yann Dubois 84 Jan 02, 2023
GAN-generated image detection based on CNNs

GAN-image-detection This repository contains a GAN-generated image detector developed to distinguish real images from synthetic ones. The detector is

Image and Sound Processing Lab 17 Dec 15, 2022
CUda Matrix Multiply library.

cumm CUda Matrix Multiply library. cumm is developed during learning of CUTLASS, which use too much c++ template and make code unmaintainable. So I de

49 Dec 27, 2022
RAMA: Rapid algorithm for multicut problem

RAMA: Rapid algorithm for multicut problem Solves multicut (correlation clustering) problems orders of magnitude faster than CPU based solvers without

Paul Swoboda 60 Dec 13, 2022
An implementation of the AdaOPS (Adaptive Online Packing-based Search), which is an online POMDP Solver used to solve problems defined with the POMDPs.jl generative interface.

AdaOPS An implementation of the AdaOPS (Adaptive Online Packing-guided Search), which is an online POMDP Solver used to solve problems defined with th

9 Oct 05, 2022
Repository for XLM-T, a framework for evaluating multilingual language models on Twitter data

This is the XLM-T repository, which includes data, code and pre-trained multilingual language models for Twitter. XLM-T - A Multilingual Language Mode

Cardiff NLP 112 Dec 27, 2022
Ranger deep learning optimizer rewrite to use newest components

Ranger21 - integrating the latest deep learning components into a single optimizer Ranger deep learning optimizer rewrite to use newest components Ran

Less Wright 266 Dec 28, 2022
ECLARE: Extreme Classification with Label Graph Correlations

ECLARE ECLARE: Extreme Classification with Label Graph Correlations @InProceedings{Mittal21b, author = "Mittal, A. and Sachdeva, N. and Agrawal

Extreme Classification 35 Nov 06, 2022
Trying to understand alias-free-gan.

alias-free-gan-explanation Trying to understand alias-free-gan in my own way. [Chinese Version 中文版本] CC-BY-4.0 License. Tzu-Heng Lin motivation of thi

Tzu-Heng Lin 12 Mar 17, 2022
Code and data for "TURL: Table Understanding through Representation Learning"

TURL This Repo contains code and data for "TURL: Table Understanding through Representation Learning". Environment and Setup Data Pretraining Finetuni

SunLab-OSU 63 Nov 23, 2022