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
Code to reproduce the results in "Visually Grounded Reasoning across Languages and Cultures", EMNLP 2021.

marvl-code [WIP] This is the implementation of the approaches described in the paper: Fangyu Liu*, Emanuele Bugliarello*, Edoardo M. Ponti, Siva Reddy

25 Nov 15, 2022
The AugNet Python module contains functions for the fast computation of image similarity.

AugNet AugNet: End-to-End Unsupervised Visual Representation Learning with Image Augmentation arxiv link In our work, we propose AugNet, a new deep le

Ming 74 Dec 28, 2022
The VeriNet toolkit for verification of neural networks

VeriNet The VeriNet toolkit is a state-of-the-art sound and complete symbolic interval propagation based toolkit for verification of neural networks.

9 Dec 21, 2022
Python package for downloading ECMWF reanalysis data and converting it into a time series format.

ecmwf_models Readers and converters for data from the ECMWF reanalysis models. Written in Python. Works great in combination with pytesmo. Citation If

TU Wien - Department of Geodesy and Geoinformation 31 Dec 26, 2022
Numba-accelerated Pythonic implementation of MPDATA with examples in Python, Julia and Matlab

PyMPDATA PyMPDATA is a high-performance Numba-accelerated Pythonic implementation of the MPDATA algorithm of Smolarkiewicz et al. used in geophysical

Atmospheric Cloud Simulation Group @ Jagiellonian University 15 Nov 23, 2022
tmm_fast is a lightweight package to speed up optical planar multilayer thin-film device computation.

tmm_fast tmm_fast or transfer-matrix-method_fast is a lightweight package to speed up optical planar multilayer thin-film device computation. It is es

26 Dec 11, 2022
InvTorch: memory-efficient models with invertible functions

InvTorch: Memory-Efficient Invertible Functions This module extends the functionality of torch.utils.checkpoint.checkpoint to work with invertible fun

Modar M. Alfadly 12 May 12, 2022
Caffe: a fast open framework for deep learning.

Caffe Caffe is a deep learning framework made with expression, speed, and modularity in mind. It is developed by Berkeley AI Research (BAIR)/The Berke

Berkeley Vision and Learning Center 33k Dec 28, 2022
Running Google MoveNet Multipose Tracking models on OpenVINO.

MoveNet MultiPose Tracking on OpenVINO

60 Nov 17, 2022
FedML: A Research Library and Benchmark for Federated Machine Learning

FedML: A Research Library and Benchmark for Federated Machine Learning 📄 https://arxiv.org/abs/2007.13518 News 2021-02-01 (Award): #NeurIPS 2020# Fed

FedML-AI 2.3k Jan 08, 2023
Implementation of CVAE. Trained CVAE on faces from UTKFace Dataset to produce synthetic faces with a given degree of happiness/smileyness.

Conditional Smiles! (SmileCVAE) About Implementation of AE, VAE and CVAE. Trained CVAE on faces from UTKFace Dataset. Using an encoding of the Smile-s

Raúl Ortega 3 Jan 09, 2022
PyTorch implementation of MLP-Mixer

PyTorch implementation of MLP-Mixer MLP-Mixer: an all-MLP architecture composed of alternate token-mixing and channel-mixing operations. The token-mix

Duo Li 33 Nov 27, 2022
Data from "HateCheck: Functional Tests for Hate Speech Detection Models" (Röttger et al., ACL 2021)

In this repo, you can find the data from our ACL 2021 paper "HateCheck: Functional Tests for Hate Speech Detection Models". "test_suite_cases.csv" con

Paul Röttger 43 Nov 11, 2022
Fuzzy Overclustering (FOC)

Fuzzy Overclustering (FOC) In real-world datasets, we need consistent annotations between annotators to give a certain ground-truth label. However, in

2 Nov 08, 2022
This is a collection of our NAS and Vision Transformer work.

This is a collection of our NAS and Vision Transformer work.

Microsoft 828 Dec 28, 2022
GAN-based 3D human pose estimation model for 3DV'17 paper

Tensorflow implementation for 3DV 2017 conference paper "Adversarially Parameterized Optimization for 3D Human Pose Estimation". @inproceedings{jack20

Dominic Jack 15 Feb 27, 2021
Weakly Supervised Learning of Instance Segmentation with Inter-pixel Relations, CVPR 2019 (Oral)

Weakly Supervised Learning of Instance Segmentation with Inter-pixel Relations The code of: Weakly Supervised Learning of Instance Segmentation with I

Jiwoon Ahn 472 Dec 29, 2022
Code for our paper "SimCLS: A Simple Framework for Contrastive Learning of Abstractive Summarization", ACL 2021

SimCLS Code for our paper: "SimCLS: A Simple Framework for Contrastive Learning of Abstractive Summarization", ACL 2021 1. How to Install Requirements

Yixin Liu 150 Dec 12, 2022
Toward Spatially Unbiased Generative Models (ICCV 2021)

Toward Spatially Unbiased Generative Models Implementation of Toward Spatially Unbiased Generative Models (ICCV 2021) Overview Recent image generation

Jooyoung Choi 88 Dec 01, 2022
HDMapNet: A Local Semantic Map Learning and Evaluation Framework

HDMapNet_devkit Devkit for HDMapNet. HDMapNet: A Local Semantic Map Learning and Evaluation Framework Qi Li, Yue Wang, Yilun Wang, Hang Zhao [Paper] [

Tsinghua MARS Lab 421 Jan 04, 2023