A PyTorch implementation of EfficientDet.

Overview

EfficientDet (PyTorch)

A PyTorch implementation of EfficientDet.

It is based on the

There are other PyTorch implementations. Either their approach didn't fit my aim to correctly reproduce the Tensorflow models (but with a PyTorch feel and flexibility) or they cannot come close to replicating MS COCO training from scratch.

Aside from the default model configs, there is a lot of flexibility to facilitate experiments and rapid improvements here -- some options based on the official Tensorflow impl, some of my own:

  • BiFPN connections and combination mode are fully configurable and not baked into the model code
  • BiFPN and head modules can be switched between depthwise separable or standard convolutions
  • Activations, batch norm layers are switchable via arguments (soon config)
  • Any backbone in my timm model collection that supports feature extraction (features_only arg) can be used as a bacbkone.

Updates

2021-04-30

2021-02-18

  • Add some new model weights with bilinear interpolation for upsample and downsample in FPN.
    • 40.9 mAP - efficientdet_q1 (replace prev model at 40.6)
    • 43.2 mAP -cspresdet50
    • 45.2 mAP - cspdarkdet53m

2020-12-07

  • Training w/ fully jit scripted model + bench (--torchscript) is possible with inclusion of ModelEmaV2 from timm and previous torchscript compat additions. Big speed gains for CPU bound training.
  • Add weights for alternate FPN layouts. QuadFPN experiments (efficientdet_q0/q1/q2) and CSPResDeXt + PAN (cspresdext50pan). See updated table below. Special thanks to Artus for providing resources for training the Q2 model.
  • Heads can have a different activation from FPN via config
  • FPN resample (interpolation) can be specified via config and include any F.interpolation method or max/avg pool
  • Default focal loss changed back to new_focal, use --legacy-focal arg to use the original. Legacy uses less memory, but has more numerical stability issues.
  • custom augmentation transform and collate fn can be passed to loader factory
  • timm >= 0.3.2 required, NOTE double check any custom defined model config for breaking change
  • PyTorch >= 1.6 now required

2020-11-12

  • add experimental PAN and Quad FPN configs to the existing EfficientDet BiFPN w/ two test model configs
  • switch untrained experimental model configs to use torchscript compat bn head layout by default

2020-11-09

  • set model config to read-only after creation to reduce likelyhood of misuse
  • no accessing model or bench .config attr in forward() call chain (for torcscript compat)
  • numerous smaller changes that allow jit scripting of the model or train/predict bench

2020-10-30

Merged a few months of accumulated fixes and additions.

  • Proper fine-tuning compatible model init (w/ changeable # classes and proper init, demoed in train.py)
  • A new dataset interface with dataset support (via parser classes) for COCO, VOC 2007/2012, and OpenImages V5/Challenge2019
  • New focal loss def w/ label smoothing available as an option, support for jit of loss fn for (potential) speedup
  • Improved a few hot spots that squeek out a couple % of throughput gains, higher GPU utilization
  • Pascal / OpenImages evaluators based on Tensorflow Models Evaluator framework (usable for other datasets as well)
  • Support for native PyTorch DDP, SyncBN, and AMP in PyTorch >= 1.6. Still defaults to APEX if installed.
  • Non-square input image sizes are allowed for the model (the anchor layout). Specified by image_size tuple in model config. Currently still restricted to size % 128 = 0 on each dim.
  • Allow anchor target generation to be done in either dataloader process' via collate or in model as in past. Can help balance compute.
  • Filter out unused target cls/box from dataset annotations in fixed size batch tensors before passing to target assigner. Seems to speed convergence.
  • Letterbox aware Random Erasing augmentation added.
  • A (very slow) SoftNMS impl added for inference/validation use. It can be manually enabled right now, can add arg if demand.
  • Tested with PyTorch 1.7
  • Add ResDet50 model weights, 41.6 mAP.

A few things on priority list I haven't tackled yet:

  • Mosaic augmentation
  • bbox IOU loss (tried a bit but so far not a great result, need time to debug/improve)

NOTE There are some breaking changes:

  • Predict and Train benches now output XYXY boxes, NOT XYWH as before. This was done to support other datasets as XYWH is COCO's evaluator requirement.
  • The TF Models Evaluator operates on YXYX boxes like the models. Conversion from XYXY is currently done by default. Why don't I just keep everything YXYX? Because PyTorch GPU NMS operates in XYXY.
  • You must update your version of timm to the latest (>=0.3), as some APIs for helpers changed a bit.

Training sanity checks were done on VOC and OI

  • 80.0 @ 50 mAP finetune on voc0712 with no attempt to tune params (roughly as per command below)
  • 18.0 mAP @ 50 for OI Challenge2019 after couple days of training (only 6 epochs, eek!). It's much bigger, and takes a LOONG time, many classes are quite challenging.

2020-09-03

  • All models updated to latest checkpoints from TF original.
  • Add experimental soft-nms code, must be manually enabled right now. It is REALLY slow, .1-.2 mAP increase.

2020-07-27

  • Add updated TF ported weights for D3 model (better training) and model def and weights for new D7X model (54.3 val mAP)
  • Fix Windows bug so it at least trains in non-distributed mode

2020-06-15

Add updated D7 weights from Tensorflow impl, 53.1 validation mAP here (53.4 in TF)

2020-06-14

New model results, I've trained a D1 model with some WIP augmentation enhancements (not commited), just squeaking by official weights.

EfficientDet-D1:

 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.393798
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.586831
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.420305
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.191880
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.455586
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.571316

Also, Soyeb Nagori trained an EfficientDet-Lite0 config using this code and contributed the weights.

 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.319861
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.500062
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.336777
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.111257
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.378062
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.501938

Unlike the other tf_ prefixed models this is not ported from (as of yet unreleased) TF official model, but it used TF ported weights from timm for the pretrained imagenet model as the backbone init, thus it uses SAME padding.

Models

The table below contains models with pretrained weights. There are quite a number of other models that I have defined in model configurations that use various timm backbones.

Variant mAP (val2017) mAP (test-dev2017) mAP (TF official val2017) mAP (TF official test-dev2017) Params (M)
tf_efficientdet_lite0 32.0 TBD N/A N/A 3.24
efficientdet_d0 33.6 TBD 33.5 33.8 3.88
tf_efficientdet_d0 34.2 TBD 34.3 34.6 3.88
tf_efficientdet_d0_ap 34.8 TBD 35.2 35.3 3.88
efficientdet_q0 35.7 TBD N/A N/A 4.13
efficientdet_d1 39.4 39.5 39.1 39.6 6.62
tf_efficientdet_d1 40.1 TBD 40.2 40.5 6.63
tf_efficientdet_d1_ap 40.8 TBD 40.9 40.8 6.63
efficientdet_q1 40.9 TBD N/A N/A 6.98
cspresdext50pan 41.2 TBD N/A N/A 22.2
resdet50 41.6 TBD N/A N/A 27.6
efficientdet_q2 43.1 TBD N/A N/A 8.81
cspresdet50 43.2 TBD N/A N/A 24.3
tf_efficientdet_d2 43.4 TBD 42.5 43 8.10
tf_efficientdet_d2_ap 44.2 TBD 44.3 44.3 8.10
cspdarkdet53m 45.2 TBD N/A N/A 35.6
tf_efficientdet_d3 47.1 TBD 47.2 47.5 12.0
tf_efficientdet_d3_ap 47.7 TBD 48.0 47.7 12.0
tf_efficientdet_d4 49.2 TBD 49.3 49.7 20.7
tf_efficientdet_d4_ap 50.2 TBD 50.4 50.4 20.7
tf_efficientdet_d5 51.2 TBD 51.2 51.5 33.7
tf_efficientdet_d6 52.0 TBD 52.1 52.6 51.9
tf_efficientdet_d5_ap 52.1 TBD 52.2 52.5 33.7
tf_efficientdet_d7 53.1 53.4 53.4 53.7 51.9
tf_efficientdet_d7x 54.3 TBD 54.4 55.1 77.1

See model configurations for model checkpoint urls and differences.

NOTE: Official scores for all modules now using soft-nms, but still using normal NMS here.

NOTE: In training some experimental models, I've noticed some potential issues with the combination of synchronized BatchNorm (--sync-bn) and model EMA weight everaging (--model-ema) during distributed training. The result is either a model that fails to converge, or appears to converge (training loss) but the eval loss (running BN stats) is garbage. I haven't observed this with EfficientNets, but have with some backbones like CspResNeXt, VoVNet, etc. Disabling either EMA or sync bn seems to eliminate the problem and result in good models. I have not fully characterized this issue.

Environment Setup

Tested in a Python 3.7 or 3.8 conda environment in Linux with:

NOTE - There is a conflict/bug with Numpy 1.18+ and pycocotools 2.0, force install numpy <= 1.17.5 or ensure you install pycocotools >= 2.0.2

Dataset Setup and Use

COCO

MSCOCO 2017 validation data:

wget http://images.cocodataset.org/zips/val2017.zip
wget http://images.cocodataset.org/annotations/annotations_trainval2017.zip
unzip val2017.zip
unzip annotations_trainval2017.zip

MSCOCO 2017 test-dev data:

wget http://images.cocodataset.org/zips/test2017.zip
unzip -q test2017.zip
wget http://images.cocodataset.org/annotations/image_info_test2017.zip
unzip image_info_test2017.zip

COCO Evaluation

Run validation (val2017 by default) with D2 model: python validate.py /localtion/of/mscoco/ --model tf_efficientdet_d2

Run test-dev2017: python validate.py /localtion/of/mscoco/ --model tf_efficientdet_d2 --split testdev

COCO Training

./distributed_train.sh 4 /mscoco --model tf_efficientdet_d0 -b 16 --amp --lr .09 --warmup-epochs 5 --sync-bn --opt fusedmomentum --model-ema

NOTE:

  • Training script currently defaults to a model that does NOT have redundant conv + BN bias layers like the official models, set correct flag when validating.
  • I've only trained with img mean (--fill-color mean) as the background for crop/scale/aspect fill, the official repo uses black pixel (0) (--fill-color 0). Both likely work fine.
  • The official training code uses EMA weight averaging by default, it's not clear there is a point in doing this with the cosine LR schedule, I find the non-EMA weights end up better than EMA in the last 10-20% of training epochs
  • The default h-params is a very close to unstable (exploding loss), don't try using Nesterov momentum. Try to keep the batch size up, use sync-bn.

Pascal VOC

2007, 2012, and combined 2007 + 2012 w/ labeled 2007 test for validation are supported.

wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar
wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar
wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar
find . -name '*.tar' -exec tar xf {} \;

There should be a VOC2007 and VOC2012 folder within VOCdevkit, dataset root for cmd line will be VOCdevkit.

Alternative download links, slower but up more often than ox.ac.uk:

http://pjreddie.com/media/files/VOCtrainval_11-May-2012.tar
http://pjreddie.com/media/files/VOCtrainval_06-Nov-2007.tar
http://pjreddie.com/media/files/VOCtest_06-Nov-2007.tar

VOC Evaluation

Evaluate on VOC2012 validation set: python validate.py /data/VOCdevkit --model efficientdet_d0 --num-gpu 2 --dataset voc2007 --checkpoint mychekpoint.pth --num-classes 20

VOC Training

Fine tune COCO pretrained weights to VOC 2007 + 2012: /distributed_train.sh 4 /data/VOCdevkit --model efficientdet_d0 --dataset voc0712 -b 16 --amp --lr .008 --sync-bn --opt fusedmomentum --warmup-epochs 3 --model-ema --model-ema-decay 0.9966 --epochs 150 --num-classes 20 --pretrained

OpenImages

Setting up OpenImages dataset is a commitment. I've tried to make it a bit easier wrt to the annotations, but grabbing the dataset is still going to take some time. It will take approx 560GB of storage space.

To download the image data, I prefer the CVDF packaging. The main OpenImages dataset page, annotations, dataset license info can be found at: https://storage.googleapis.com/openimages/web/index.html

CVDF Images Download

Follow the s3 download directions here: https://github.com/cvdfoundation/open-images-dataset#download-images-with-bounding-boxes-annotations

Each train_.tar.gz should be extracted to train/ folder, where x is a hex digit from 0-F. validation.tar.gz can be extracted as flat files into validation/.

Annotations Download

Annotations can be downloaded separately from the OpenImages home page above. For convenience, I've packaged them all together with some additional 'info' csv files that contain ids and stats for all image files. My datasets rely on the -info.csv files. Please see https://storage.googleapis.com/openimages/web/factsfigures.html for the License of these annotations. The annotations are licensed by Google LLC under CC BY 4.0 license. The images are listed as having a CC BY 2.0 license.

wget https://github.com/rwightman/efficientdet-pytorch/releases/download/v0.1-anno/openimages-annotations.tar.bz2
wget https://github.com/rwightman/efficientdet-pytorch/releases/download/v0.1-anno/openimages-annotations-challenge-2019.tar.bz2
find . -name '*.tar.bz2' -exec tar xf {} \;

Layout

Once everything is downloaded and extracted the root of your openimages data folder should contain:

annotations/
annotations/challenge-2019/
train/0/
.
.
.
train/f/
validation/

OpenImages Training

Training with Challenge2019 annotations (500 classes): ./distributed_train.sh 4 /data/openimages --model efficientdet_d0 --dataset openimages-challenge2019 -b 7 --amp --lr .042 --sync-bn --opt fusedmomentum --warmup-epochs 1 --lr-noise 0.4 0.9 --model-ema --model-ema-decay 0.999966 --epochs 100 --remode pixel --reprob 0.15 --recount 4 --num-classes 500 --val-skip 2

The 500 (Challenge2019) or 601 (V5/V6) class head for OI takes up a LOT more GPU memory vs COCO. You'll likely need to half batch sizes.

Examples of Training / Fine-Tuning on Custom Datasets

The models here have been used with custom training routines and datasets with great results. There are lots of details to figure out so please don't file any 'I get crap results on my custom dataset issues'. If you can illustrate a reproducible problem on a public, non-proprietary, downloadable dataset, with public github fork of this repo including working dataset/parser implementations, I MAY have time to take a look.

Examples:

If you have a good example script or kernel training these models with a different dataset, feel free to notify me for inclusion here...

Results

My Training

EfficientDet-D0

Latest training run with .336 for D0 (on 4x 1080ti): ./distributed_train.sh 4 /mscoco --model efficientdet_d0 -b 22 --amp --lr .12 --sync-bn --opt fusedmomentum --warmup-epochs 5 --lr-noise 0.4 0.9 --model-ema --model-ema-decay 0.9999

These hparams above resulted in a good model, a few points:

  • the mAP peaked very early (epoch 200 of 300) and then appeared to overfit, so likely still room for improvement
  • I enabled my experimental LR noise which tends to work well with EMA enabled
  • the effective LR is a bit higher than official. Official is .08 for batch 64, this works out to .0872
  • drop_path (aka survival_prob / drop_connect) rate of 0.1, which is higher than the suggested 0.0 for D0 in official, but lower than the 0.2 for the other models
  • longer EMA period than default

VAL2017

 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.336251
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.521584
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.356439
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.123988
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.395033
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.521695
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.287121
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.441450
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.467914
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.197697
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.552515
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.689297

EfficientDet-D1

Latest run with .394 mAP (on 4x 1080ti): ./distributed_train.sh 4 /mscoco --model efficientdet_d1 -b 10 --amp --lr .06 --sync-bn --opt fusedmomentum --warmup-epochs 5 --lr-noise 0.4 0.9 --model-ema --model-ema-decay 0.99995

For this run I used some improved augmentations, still experimenting so not ready for release, should work well without them but will likely start overfitting a bit sooner and possibly end up a in the .385-.39 range.

Ported Tensorflow weights

TEST-DEV2017

NOTE: I've only tried submitting D7 to dev server for sanity check so far

TF-EfficientDet-D7
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.534
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.726
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.577
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.356
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.569
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.660
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.397
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.644
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.682
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.508
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.718
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.818

VAL2017

TF-EfficientDet-D0
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.341877
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.525112
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.360218
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.131366
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.399686
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.537368
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.293137
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.447829
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.472954
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.195282
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.558127
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.695312
TF-EfficientDet-D1
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.401070
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.590625
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.422998
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.211116
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.459650
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.577114
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.326565
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.507095
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.537278
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.308963
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.610450
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.731814
TF-EfficientDet-D2
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.434042
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.627834
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.463488
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.237414
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.486118
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.606151
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.343016
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.538328
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.571489
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.350301
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.638884
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.746671
TF EfficientDet-D3
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.471223
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.661550
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.505127
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.301385
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.518339
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.626571
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.365186
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.582691
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.617252
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.424689
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.670761
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.779611
TF-EfficientDet-D4
Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.491759
Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.686005
Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.527791
Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.325658
Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.536508
Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.635309
Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.373752
Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.601733
Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.638343
Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.463057
Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.685103
Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.789180
TF-EfficientDet-D5
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.511767
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.704835
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.552920
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.355680
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.551341
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.650184
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.384516
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.619196
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.657445
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.499319
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.695617
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.788889
TF-EfficientDet-D6
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.520200
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.713204
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.560973
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.361596
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.567414
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.657173
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.387733
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.629269
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.667495
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.499002
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.711909
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.802336
TF-EfficientDet-D7
Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.531256
Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.724700
Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.571787
Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.368872
Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.573938
Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.668253
Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.393620
Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.637601
Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.676987
Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.524850
Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.717553
Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.806352
TF-EfficientDet-D7X
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.543
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.737
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.585
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.401
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.579
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.680
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.398
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.649
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.689
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.550
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.725
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.823

TODO

  • Basic Training (object detection) reimplementation
  • Mosaic Augmentation
  • Rand/AutoAugment
  • BBOX IoU loss (giou, diou, ciou, etc)
  • Training (semantic segmentation) experiments
  • Integration with Detectron2 / MMDetection codebases
  • Addition and cleanup of EfficientNet based U-Net and DeepLab segmentation models that I've used in past projects
  • Addition and cleanup of OpenImages dataset/training support from a past project
  • Exploration of instance segmentation possibilities...

If you are an organization is interested in sponsoring and any of this work, or prioritization of the possible future directions interests you, feel free to contact me (issue, LinkedIn, Twitter, hello at rwightman dot com). I will setup a github sponser if there is any interest.

Comments
  • Training COCO from Scratch

    Training COCO from Scratch

    Thanks for the good work!

    Just wanted to mention that I have tried the two currently most stared EfficientDet PyTorch repos on Github, and neither reproduce the paper results on COCO, not even close.

    They mostly claim they train on custom data and port weights from official TF checkpoints, but fail to train from scratch on COCO.

    I tried their implementations with 200+ kinds of hyper-parameter tuning sets & settings - yes 200+ jobs!

    Very keen to see your completed training on COCO. Looking forward to that.

    Cheers

    opened by factplay1 27
  • Training on Private Dataset

    Training on Private Dataset

    Thank you for sharing this code with us.

    Can I train on my own dataset with only 11 classes? I am overriding config.num_classes with 11 and overriding config.image_size with 512 but I get very bad results, it is almost like the model is not even aware of the image..

    I made sure to put in the boxes as yxyx in the dataset and also made sure the classes start from 1 as I think it is needed due to how fast_collate is working.

    Would appreciate your kind help, thank you.

    opened by ofekp 25
  • EfficientDetLite0

    EfficientDetLite0

    I am curious to know your view on efficientnetLiteB0 as a backbone. Google has officially not released but do you think switching backbone from efficientnetB0 to efficientnetLiteB0 will make coco AP degrade less than 5% of original or it will degrade more?

    In the current code base, if I call efficientnetLiteB0 from your timm model collection, will it work?

    opened by soyebn 24
  • anchor_labeler: batch_label_anchors issue with single bounding box

    anchor_labeler: batch_label_anchors issue with single bounding box

    Hi @rwightman

    Thank you so much for making this repo.

    I am currently experiencing an issue calling batch_label_anchors when ground truth bounding box list only has 1 bbox. Not sure what might caused this issue, I am wondering if you can take a look. Thanks in advance :)

    Issue: anchor_labeler.batch_label_anchors () has index out of range error. Trace attached

    Setup anchor:

    model_config = get_efficientdet_config('tf_efficientdet_d0')
    model = EfficientDet(model_config,pretrained_backbone=True)
    model_config.num_classes = 1
    model_config.image_size = 512
    
    anchors = Anchors(
        model_config.min_level,model_config.max_level,
        model_config.num_scales, model_config.aspect_ratios,
        model_config.anchor_scale, model_config.image_size
        )
    
    
    anchor_labeler = AnchorLabeler(anchors,model_config.num_classes,match_threshold=0.5)
    

    Reproduce:

    tb = torch.tensor([[468.,353.,52.,386.5]])
    tb = tb.int().float()
    tlbl = torch.tensor([1.])
    cls_targets, box_targets,num_positives = anchor_labeler.batch_label_anchors(1,[tb],[tlbl])
    

    Trace:

    ---------------------------------------------------------------------------
    IndexError                                Traceback (most recent call last)
    <ipython-input-45-e8bceaf11fb2> in <module>
    ----> 1 cls_targets, box_targets,num_positives = anchor_labeler.batch_label_anchors(1,[tb],[tlbl])
    
    /opt/conda/envs/fastai2/lib/python3.7/site-packages/effdet/anchors.py in batch_label_anchors(self, batch_size, gt_boxes, gt_classes)
        394             # cls_weights, box_weights are not used
        395             cls_targets, _, box_targets, _, matches = self.target_assigner.assign(
    --> 396                 anchor_box_list, BoxList(gt_boxes[i]), gt_classes[i])
        397 
        398             # class labels start from 1 and the background class = -1
    
    /opt/conda/envs/fastai2/lib/python3.7/site-packages/effdet/object_detection/target_assigner.py in assign(self, anchors, groundtruth_boxes, groundtruth_labels, groundtruth_weights)
        144         match_quality_matrix = self._similarity_calc.compare(groundtruth_boxes, anchors)
        145         match = self._matcher.match(match_quality_matrix)
    --> 146         reg_targets = self._create_regression_targets(anchors, groundtruth_boxes, match)
        147         cls_targets = self._create_classification_targets(groundtruth_labels, match)
        148         reg_weights = self._create_regression_weights(match, groundtruth_weights)
    
    /opt/conda/envs/fastai2/lib/python3.7/site-packages/effdet/object_detection/target_assigner.py in _create_regression_targets(self, anchors, groundtruth_boxes, match)
        167         zero_box = torch.zeros(4, device=device)
        168         matched_gt_boxes = match.gather_based_on_match(
    --> 169             groundtruth_boxes.boxes(), unmatched_value=zero_box, ignored_value=zero_box)
        170         matched_gt_boxlist = box_list.BoxList(matched_gt_boxes)
        171         if groundtruth_boxes.has_field(self._keypoints_field_name):
    
    /opt/conda/envs/fastai2/lib/python3.7/site-packages/effdet/object_detection/matcher.py in gather_based_on_match(self, input_tensor, unmatched_value, ignored_value)
        171         input_tensor = torch.cat([ss, input_tensor], dim=0)
        172         gather_indices = torch.clamp(self.match_results + 2, min=0)
    --> 173         gathered_tensor = torch.index_select(input_tensor, 0, gather_indices)
        174         return gathered_tensor
    
    IndexError: index out of range in self
    
    Here are some values:
    ipdb> p input_tensor
    tensor([[  0.,   0.,   0.,   0.],
            [  0.,   0.,   0.,   0.],
            [468., 353.,  52., 386.]])
    
    ipdb> p gather_indices.shape
    torch.Size([49104])
    
    ipdb> p gather_indices
    tensor([    1,     1,     1,  ...,     1,     1, 24554])
    
    ipdb> p self.match_results
    tensor([   -1,    -1,    -1,  ...,    -1,    -1, 24552])
    
    
    opened by heye0507 23
  • exporting to onnx

    exporting to onnx

    I am trying to get this model (trained on custom dataset) to run under opencv so it will perform better on jetson nano. However, conversion to ONNX does not go well. this is the code i am using:

    from effdet import get_efficientdet_config, EfficientDet                                                                                                                 
    from effdet.bench import DetBenchPredict                                                                                                                                 
    from effdet.efficientdet import HeadNet     
    
    def load_net(checkpoint_path):                                                                                                                                           
        config = get_efficientdet_config('tf_efficientdet_d1')                                                                                                               
        net = EfficientDet(config, pretrained_backbone=False)                                                                                                                
                                                                                                                                                                             
        config.num_classes = 1                                                                                                                                               
        config.image_size=512                                                                                                                                                
        net.class_net = HeadNet(config, num_outputs=config.num_classes, norm_kwargs=dict(eps=.001, momentum=.01))                                                            
                                                                                                                                                                             
        checkpoint = torch.load(checkpoint_path)                                                                                                                             
        net.load_state_dict(checkpoint['model_state_dict'])                                                                                                                  
        net = DetBenchPredict(net, config)                                                                                                                                   
        net.eval();                                                                                                                                                          
        return net.cuda()  
    
    import torch
    from functools import partial
    
    def load_model_weight(model, model_path):
        model=torch.load(model_path)
        model = model.eval()
        return model
    
    def export_onnx_model(model, input_shape, onnx_path, input_names=None, output_names=None, dynamic_axes=None):
        inputs = torch.ones(*input_shape)
        origin_forward = model.forward
        model.forward = partial(
            model.forward, img_scales=torch.tensor([1.0], dtype=torch.float).cuda(), img_size=torch.tensor([input_shape[-2:]], dtype=torch.float).cuda())
        #model(inputs)
        torch.onnx.export(model, (inputs), onnx_path, input_names=input_names, output_names=output_names, dynamic_axes=dynamic_axes)
    
    model_path = "best-checkpoint-013epoch.bin"
    model = load_net(model_path)
    input_shape = (1, 3, 512, 512)
    onnx_path = "test.onnx"
    export_onnx_model(model, input_shape, onnx_path)
    
    

    but it gives:

         17 # Calculate asymmetric TensorFlow-like 'SAME' padding for a convolution
         18 def get_same_padding(x: int, k: int, s: int, d: int):
    ---> 19     return max((math.ceil(x / s) - 1) * s + (k - 1) * d + 1 - x, 0)
         20 
         21 
    
    RuntimeError: Integer division of tensors using div or / is no longer supported, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead.
    
    opened by mosheliv 12
  • Loss becoming nan while training on large batch size on COCO

    Loss becoming nan while training on large batch size on COCO

    Hey @rwightman , I am trying to train EfficientDet D0 model on COCO from scratch, it works perfectly and converges when I use your settings: ./distributed_train.sh 4 /mscoco --model efficientdet_d0 -b 22 --amp --lr .12 --sync-bn --opt fusedmomentum --warmup-epochs 5 --lr-noise 0.4 0.9 --model-ema --model-ema-decay 0.9999

    But when I use a Larger Batch size setting like the following, loss becomes nan:

    1. Number of GPU=8 and Per GPU batch size=30 and lr=0.32 (Single Node)
    2. Number of GPU=32 and Per GPU batch size=30 and lr=1.39 (Multi Node) Both FP32 and AMP
    3. Number of GPU=32 and Per GPU batch size=30 and lr=0.86 (Multi Node) LR I chose midway between linear scaling and square-root scaling. Both FP32 and AMP.

    In case of AMP there is a cascade of loss scaling and then the loss becomes nan, And this does not necessarily happen in the first few epochs.

    Strangely enough the TF1 Google automl code base has no problem scaling linearly. Do you know what might be the problem here? Do I need to change the recipe when using a large batch size?

    opened by subhankar-ghosh 10
  • Info request - best practice for config custom datasets?

    Info request - best practice for config custom datasets?

    Hi @rwightman - super excited that you have made this! Can you describe best method for training on custom datasets? (I can hack it up but prefer if you have have advice up front). Thanks!

    opened by lessw2020 10
  • Improve stability of focal loss impl

    Improve stability of focal loss impl

    torch.exp(neg_logits) will give a NaN for a large negative value of neg_logits. Prevent this by replacing torch.log1p(torch.exp(neg_logits)) with torch.logaddexp(neg_logits, 0).

    logaddexp(x, y) is log(exp(x) + exp(y)), so logaddexp(x, 0) is log(exp(x) + 1). This is equivalent to log1p(exp(x)) which is just log(exp(x) + 1).

    The implementation of logaddexp does not return a NaN if the operands are very large. It is equivalent to max(x, y) + log(1 + exp(-1 * abs(x - y))). This forces the exp to be called with a large negative value instead of a large positive value.

    I'm not clear on how this changes the back-propagation behaviour. Also, I think logaddexp was only available from pytorch 1.6.0.

    opened by bharrisau 9
  • New SOTA reported by original TF repo, any plans to sync-up the changes?

    New SOTA reported by original TF repo, any plans to sync-up the changes?

    Thanks for your good work.

    https://github.com/google/automl/tree/master/efficientdet

    They now report 34.3 val mAP for EffDet-D0. Not sure what exactly they did, but seems like they made some changes in their model definition etc. It'd be great if you could have a look at their changes, and potentially sync-up your repo so it reproduces those numbers.

    Thanks a million :)

    opened by factplay1 8
  • ONNX Export

    ONNX Export

    Have you tried ONNX export for tf_efficientdet_lite0? I tried with exporting only backbone+BiFPN by defining forward_dummy similar to used in mmdetect. I got very complicated ONNX graph (Scatter/Gather/Div/Squeeze etc..) Whereas efficientNetLite models you exported using gen-efficientnet-pytorch/blob/master/onnx_export.py are very clean.

    Is there a way to get clean ONNX graph for tf_efficientdet_lite0?

    Thanks a lot for all your help.

    enhancement help wanted 
    opened by soyebn 8
  • bbox coordinates

    bbox coordinates

    If I am training on a custom dataset and preparing a dataloader on my own should I input the box in the format [yxyx] or [xyxy]. (I see in the ConfigParser the bbox_yxyx: bool = True) Right now, I input in the form of [yxyx].

    For the detections, like it is stated in the READme that the GPU NMS Pytorch supports XYXY. I am a bit confused if I will have to input the box in [xyxy] or [yxyx].

    Also, in the DetbenchTrain and Predict I don't see any flag converting into [XYXY] by default. However, in the evaluator PascalEvaluator if pred_yxyx is False then img_dets[:, [1,0,3,2]] is stated . This means it supports img_pred_xyxy as True which indiretly puts the detected boxes in [xyxy]. Eventually, the iou(boxes1, boxes2) need bboxes in [yxyx]. So, I cannot debug the conversion from [xyxy] to [yxyx] here.

    So I am a bit confused if how the output['detections'][:4] i.e, the generate_detections from anchors.py gives which output format?

    Since the decode_box_output function in the anchors.py takes [yxyx] as an input I had input the input target bbox as [yxyx]. Did I do it right?

    TIA

    opened by Ekta246 7
  • [BUG] Cannot save torchscripted model

    [BUG] Cannot save torchscripted model

    Describe the bug Unable to save a model after successfully torch-scripting it.

    To Reproduce

    The following snippet:

    from effdet import EfficientDet
    from effdet.config.model_config import get_efficientdet_config
    import torch
    
    architecture = "tf_efficientdet_d1"
    config = get_efficientdet_config(architecture)
    model = EfficientDet(config, pretrained_backbone=True)
    model.toggle_head_bn_level_first()
    ts_model = torch.jit.script(model)
    torch.jit.save(ts_model, "model.pt")
    

    produces the following output:

    (venv) [email protected]: python failing_effdet.py 
    Traceback (most recent call last):
      File "failing_effdet.py", line 10, in <module>
        torch.jit.save(ts_model, "model.pt")
      File "/home/maxime/mambaforge/envs/venv/lib/python3.8/site-packages/torch/jit/_serialization.py", line 81, in save
        m.save(f, _extra_files=_extra_files)
      File "/home/maxime/mambaforge/envs/venv/lib/python3.8/site-packages/torch/jit/_script.py", line 714, in save
        return self._c.save(str(f), **kwargs)
    RuntimeError: 
    Could not export Python function call '_forward'. Remove calls to Python functions before export. Did you forget to add @script or @script_method annotation? If this is a nn.ModuleList, add it to __constants__:
      File "/home/maxime/mambaforge/envs/venv/lib/python3.8/site-packages/effdet/efficientdet.py", line 440
                return self._forward_level_first(x)
            else:
                return self._forward(x)
                       ~~~~~~~~~~~~~ <--- HERE
    

    Expected behavior Using model.toggle_head_bn_level_first() should have made torchscript happy, because the _forward method, which depends on it, is illegal for torchscript. However, it seems that the function is still checked before saving.

    Scripting + saving works fine with torchvision and pytorch lightning models.

    Desktop:

    • OS: Ubuntu using WSL2 with VSCode
    • python==3.8
    • effdet==0.3.0
    • torch==1.12.0
    • CPU only (not attempted on GPU yet)
    bug 
    opened by dotXem 0
  • Maybe buf fix

    Maybe buf fix

    Found this commit, but did not check it. Looks like as bug fix: https://github.com/ceshine/efficientdet-pytorch/commit/b8ccb5247533645db523d17a8dec4ae9ad612fe9

    bug 
    opened by MichaelMonashev 0
  • Problem with create model from pretrained checkpoint

    Problem with create model from pretrained checkpoint

    Hi! Thanks for your repo, it's very useful. But i met with some problem when tried to create model from pretrained checkpoint. I'm using effdet==0.3.0 package. When i run the folowing code: model = create_model("tf_efficientdet_d5", bench_task="train", num_classes=3, image_size=(512, 512), bench_labeler=True, pretrained=False, checkpoint_path="tf_efficientdet_d5_51-c79f9be6.pth" ) I get the following error: 'size mismatch for class_net.predict.conv_pw.weight' on line 'load_checkpoint(model, checkpoint_path, use_ema=checkpoint_ema)' of the file 'effdet/factory.py"'

    After that in the file 'effdet/factory.py' i placed code : ' if checkpoint_path: load_checkpoint(model, checkpoint_path, use_ema=checkpoint_ema)' before code: if num_classes is not None and num_classes != config.num_classes: model.reset_head(num_classes=num_classes) and error is gone. Did you met with such problem?

    bug 
    opened by badbul 0
  • Initial Mosaic augmentation implementation

    Initial Mosaic augmentation implementation

    As per your given TODOs in the README, I thought it would be nice to add initial mosaic augmentation to this codebase. Original implementation is from YoloV5 repo, which I have slightly tweaked to fit here.

    I currently do not have the hardware to train with this implementation, but I still would like to contribute. Thats how some of them look visualized from the train script in img, target = create_dataset(args) train_img_26 img_14.

    Sometimes the bboxes look off as well. If you give me any pointers to improve the implementation, or to test (on limited hardware) whether this augmentation works here, please let me know. I am willing to make changes if needed, as I am just starting in this deep learning world.

    It does add an opencv dependency as per the original repo, so dont know whether that is a problem. Thanks!

    opened by dmatos2012 3
  • [FEATURE] OpenImages Pretrained Models

    [FEATURE] OpenImages Pretrained Models

    Hi Ross, thanks for sharing this repo! Curious if you have any plans on releasing a model trained on OpenImages?

    Is your feature request related to a problem? Please describe. No

    Describe the solution you'd like Have access to a pretrained model trained on OpenImages

    Describe alternatives you've considered The official repo (see here), but their model is outdated and it's also in tensorflow, which is inconvenient

    Additional context N/A

    enhancement 
    opened by rsomani95 4
  • [BUG] OSError: [Errno 38] Function not implemented

    [BUG] OSError: [Errno 38] Function not implemented

    Hi! I'm trying to train tf_efficientdet_d3 with your code on custom coco-like data. I'm training on Google Colab. !python3 train.py '/content/drive/MyDrive/dataset' --model tf_efficientdet_d3 --num-classes 60 --pretrained -b 1 --save-images --log-interval 100 --epochs 10 --output '/content/drive/MyDrive/Colab Notebooks/PyTorch training/' After the first epoch, I faced with this type of error:

    Traceback (most recent call last):
      File "train.py", line 656, in <module>
        main()
      File "train.py", line 435, in main
        best_metric, best_epoch = saver.save_checkpoint(epoch=epoch, metric=eval_metrics[eval_metric])
      File "/usr/local/lib/python3.7/dist-packages/timm-0.4.5-py3.7.egg/timm/utils/checkpoint_saver.py", line 78, in save_checkpoint
        os.link(last_save_path, save_path)
    OSError: [Errno 38] Function not implemented: '/content/drive/MyDrive/Colab Notebooks/PyTorch training/train/20210311-161812-tf_efficientdet_d3/last.pth.tar' -> '/content/drive/MyDrive/Colab Notebooks/PyTorch training/train/20210311-161812-tf_efficientdet_d3/checkpoint-0.pth.tar'
    

    Something went wrong during the process of saving the checkpoint. I'll be grateful to recieve the solution of this problem or some tips that may help me to solve it. Thanks!

    bug 
    opened by irinushirka 4
Releases(v0.2.4)
Owner
Ross Wightman
Always learning, constantly curious. Building ML/AI systems, watching loss curves.
Ross Wightman
A Domain-Agnostic Benchmark for Self-Supervised Learning

DABS: A Domain Agnostic Benchmark for Self-Supervised Learning This repository contains the code for DABS, a benchmark for domain-agnostic self-superv

Alex Tamkin 81 Dec 09, 2022
CenterPoint 3D Object Detection and Tracking using center points in the bird-eye view.

CenterPoint 3D Object Detection and Tracking using center points in the bird-eye view. Center-based 3D Object Detection and Tracking, Tianwei Yin, Xin

Tianwei Yin 134 Dec 23, 2022
Library of various Few-Shot Learning frameworks for text classification

FewShotText This repository contains code for the paper A Neural Few-Shot Text Classification Reality Check Environment setup # Create environment pyt

Thomas Dopierre 47 Jan 03, 2023
Implements Gradient Centralization and allows it to use as a Python package in TensorFlow

Gradient Centralization TensorFlow This Python package implements Gradient Centralization in TensorFlow, a simple and effective optimization technique

Rishit Dagli 101 Nov 01, 2022
Pytorch implementation of the unsupervised object discovery method LOST.

LOST Pytorch implementation of the unsupervised object discovery method LOST. More details can be found in the paper: Localizing Objects with Self-Sup

Valeo.ai 189 Dec 25, 2022
OpenMMLab Image Classification Toolbox and Benchmark

Introduction English | 简体中文 MMClassification is an open source image classification toolbox based on PyTorch. It is a part of the OpenMMLab project. D

OpenMMLab 1.8k Jan 03, 2023
This is the repository for the AAAI 21 paper [Contrastive and Generative Graph Convolutional Networks for Graph-based Semi-Supervised Learning].

CG3 This is the repository for the AAAI 21 paper [Contrastive and Generative Graph Convolutional Networks for Graph-based Semi-Supervised Learning]. R

12 Oct 28, 2022
An implementation of the [Hierarchical (Sig-Wasserstein) GAN] algorithm for large dimensional Time Series Generation

Hierarchical GAN for large dimensional financial market data Implementation This repository is an implementation of the [Hierarchical (Sig-Wasserstein

11 Nov 29, 2022
This is a repository for a No-Code object detection inference API using the OpenVINO. It's supported on both Windows and Linux Operating systems.

OpenVINO Inference API This is a repository for an object detection inference API using the OpenVINO. It's supported on both Windows and Linux Operati

BMW TechOffice MUNICH 68 Nov 24, 2022
This is the code for ACL2021 paper A Unified Generative Framework for Aspect-Based Sentiment Analysis

This is the code for ACL2021 paper A Unified Generative Framework for Aspect-Based Sentiment Analysis Install the package in the requirements.txt, the

108 Dec 23, 2022
Tools to create pixel-wise object masks, bounding box labels (2D and 3D) and 3D object model (PLY triangle mesh) for object sequences filmed with an RGB-D camera.

Tools to create pixel-wise object masks, bounding box labels (2D and 3D) and 3D object model (PLY triangle mesh) for object sequences filmed with an RGB-D camera. This project prepares training and t

305 Dec 16, 2022
Various operations like path tracking, counting, etc by using yolov5

Object-tracing-with-YOLOv5 Various operations like path tracking, counting, etc by using yolov5

Pawan Valluri 5 Nov 28, 2022
Fibonacci Method Gradient Descent

An implementation of the Fibonacci method for gradient descent, featuring a TKinter GUI for inputting the function / parameters to be examined and a matplotlib plot of the function and results.

Emma 1 Jan 28, 2022
Multi-modal Content Creation Model Training Infrastructure including the FACT model (AI Choreographer) implementation.

AI Choreographer: Music Conditioned 3D Dance Generation with AIST++ [ICCV-2021]. Overview This package contains the model implementation and training

Google Research 365 Dec 30, 2022
Multi-Stage Episodic Control for Strategic Exploration in Text Games

XTX: eXploit - Then - eXplore Requirements First clone this repo using git clone https://github.com/princeton-nlp/XTX.git Please create two conda envi

Princeton Natural Language Processing 9 May 24, 2022
AI grand challenge 2020 Repo (Speech Recognition Track)

KorBERT를 활용한 한국어 텍스트 기반 위협 상황인지(2020 인공지능 그랜드 챌린지) 본 프로젝트는 ETRI에서 제공된 한국어 korBERT 모델을 활용하여 폭력 기반 한국어 텍스트를 분류하는 다양한 분류 모델들을 제공합니다. 본 개발자들이 참여한 2020 인공지

Young-Seok Choi 23 Jan 25, 2022
JAX bindings to the Flatiron Institute Non-uniform Fast Fourier Transform (FINUFFT) library

JAX bindings to FINUFFT This package provides a JAX interface to (a subset of) the Flatiron Institute Non-uniform Fast Fourier Transform (FINUFFT) lib

Dan Foreman-Mackey 32 Oct 15, 2022
PolyGlot, a fuzzing framework for language processors

PolyGlot, a fuzzing framework for language processors Build We tested PolyGlot on Ubuntu 18.04. Get the source code: git clone https://github.com/s3te

Software Systems Security Team at Penn State University 79 Dec 27, 2022
Improving Convolutional Networks via Attention Transfer (ICLR 2017)

Attention Transfer PyTorch code for "Paying More Attention to Attention: Improving the Performance of Convolutional Neural Networks via Attention Tran

Sergey Zagoruyko 1.4k Dec 23, 2022
This repository attempts to replicate the SqueezeNet architecture and implement the same on an image classification task.

SqueezeNet-Implementation This repository attempts to replicate the SqueezeNet architecture using TensorFlow discussed in the research paper: "Squeeze

Rohan Mathur 3 Dec 13, 2022