Implementation EfficientDet: Scalable and Efficient Object Detection in PyTorch

Overview

EfficientDet: Scalable and Efficient Object Detection, in PyTorch

A PyTorch implementation of EfficientDet from the 2019 paper by Mingxing Tan Ruoming Pang Quoc V. Le Google Research, Brain Team. The official and original: comming soon.

Fun with Demo:

python demo.py --weight ./checkpoint_VOC_efficientdet-d1_97.pth --threshold 0.6 --iou_threshold 0.5 --cam --score

Table of Contents

       

Recent Update

  • [06/01/2020] Support both DistributedDataParallel and DataParallel, change augmentation, eval_voc
  • [17/12/2019] Add Fast normalized fusion, Augmentation with Ratio, Change RetinaHead, Fix Support EfficientDet-D0->D7
  • [7/12/2019] Support EfficientDet-D0, EfficientDet-D1, EfficientDet-D2, EfficientDet-D3, EfficientDet-D4,... . Support change gradient accumulation steps, AdamW.

Benchmarking

We benchmark our code thoroughly on three datasets: pascal voc and coco, using family efficientnet different network architectures: EfficientDet-D0->7. Below are the results:

1). PASCAL VOC 2007 (Train/Test: 07trainval/07test, scale=600, ROI Align)

model   mAP
[EfficientDet-D0(with Weight)](https://drive.google.com/file/d/1r7MAyBfG5OK_9F_cU8yActUWxTHOuOpL/view?usp=sharing 62.16

Installation

  • Install PyTorch by selecting your environment on the website and running the appropriate command.
  • Clone this repository and install package prerequisites below.
  • Then download the dataset by following the instructions below.
  • Note: For training, we currently support VOC and COCO, and aim to add ImageNet support soon.

prerequisites

  • Python 3.6+
  • PyTorch 1.3+
  • Torchvision 0.4.0+ (We need high version because Torchvision support nms now.)
  • requirements.txt

Datasets

To make things easy, we provide bash scripts to handle the dataset downloads and setup for you. We also provide simple dataset loaders that inherit torch.utils.data.Dataset, making them fully compatible with the torchvision.datasets API.

VOC Dataset

PASCAL VOC: Visual Object Classes

Download VOC2007 + VOC2012 trainval & test
# specify a directory for dataset to be downloaded into, else default is ~/data/
sh datasets/scripts/VOC2007.sh
sh datasets/scripts/VOC2012.sh

COCO

Microsoft COCO: Common Objects in Context

Download COCO 2017
# specify a directory for dataset to be downloaded into, else default is ~/data/
sh datasets/scripts/COCO2017.sh

Training EfficientDet

  • To train EfficientDet using the train script simply specify the parameters listed in train.py as a flag or manually change them.
python train.py --network effcientdet-d0  # Example
  • With VOC Dataset:
# DataParallel
python train.py --dataset VOC --dataset_root /root/data/VOCdevkit/ --network effcientdet-d0 --batch_size 32 
# DistributedDataParallel with backend nccl
python train.py --dataset VOC --dataset_root /root/data/VOCdevkit/ --network effcientdet-d0 --batch_size 32 --multiprocessing-distributed
  • With COCO Dataset:
# DataParallel
python train.py --dataset COCO --dataset_root ~/data/coco/ --network effcientdet-d0 --batch_size 32
# DistributedDataParallel with backend nccl
python train.py --dataset COCO --dataset_root ~/data/coco/ --network effcientdet-d0 --batch_size 32 --multiprocessing-distributed

Evaluation

To evaluate a trained network:

  • With VOC Dataset:
    python eval_voc.py --dataset_root ~/data/VOCdevkit --weight ./checkpoint_VOC_efficientdet-d0_261.pth
  • With COCO Dataset comming soon.

Demo

python demo.py --threshold 0.5 --iou_threshold 0.5 --score --weight checkpoint_VOC_efficientdet-d1_34.pth --file_name demo.png

Output:

Webcam Demo

You can use a webcam in a real-time demo by running:

python demo.py --threshold 0.5 --iou_threshold 0.5 --cam --score --weight checkpoint_VOC_efficientdet-d1_34.pth

Performance

TODO

We have accumulated the following to-do list, which we hope to complete in the near future

  • Still to come:
    • EfficientDet-[D0-7]
    • GPU-Parallel
    • NMS
    • Soft-NMS
    • Pretrained model
    • Demo
    • Model zoo
    • TorchScript
    • Mobile
    • C++ Onnx

Authors

Note: Unfortunately, this is just a hobby of ours and not a full-time job, so we'll do our best to keep things up to date, but no guarantees. That being said, thanks to everyone for your continued help and feedback as it is really appreciated. We will try to address everything as soon as possible.

References

Citation

@article{efficientdetpytoan,
    Author = {Toan Dao Minh},
    Title = {A Pytorch Implementation of EfficientDet Object Detection},
    Journal = {github.com/toandaominh1997/EfficientDet.Pytorch},
    Year = {2019}
}
Comments
  • EfficientDet-D0(with Weight)   Object detection results are too bad

    EfficientDet-D0(with Weight) Object detection results are too bad

    Download checkpoint_VOC_efficientdet-d0_268.pth from this link: https://drive.google.com/file/d/1r7MAyBfG5OK_9F_cU8yActUWxTHOuOpL/view?usp=sharing
    ,The results of object detection is fearsome. As shown below image

    Do I have to retrain the model?

    opened by opentld 7
  • train error

    train error

    OS:ubuntu18.04 RTX 1080ti * 1

    I train efficientdet-b0 using: python3 train.py --dataset VOC --dataset_root /home/**/data/VOCdevkit/ --network effcientdet-d0 --batch_size 8 Erro shows: Traceback (most recent call last): File "train.py", line 93, in transform=get_augumentation(phase='train', width=EFFICIENTDET[args.network]['input_size'], height=EFFICIENTDET[args.network]['input_size'])) KeyError: 'effcientdet-d0'

    could you tell me how to fix this error ?

    opened by XiangjiBU 7
  • Update the url for the efficientnet backbone

    Update the url for the efficientnet backbone

    The owner of the efficientnet weights won't keep the weights on the google cloud because it's to expensive, you should upload or change theurl_map from utils.py with new urls to the weights.

    Follow this issue for more info: https://github.com/lukemelas/EfficientNet-PyTorch/issues/138

    opened by cristyioan2000 3
  • Question: Why do you freeze batch norm layers?

    Question: Why do you freeze batch norm layers?

    Hello, First, thank you for the repo!

    in EfficientDet.init line 55 [...] self.freeze_bn()

    If I want to retrain on custom data. I'd want to retrain the entire net, no?

    Thanks!

    opened by adizhol 3
  • Demo error:size mismatch for BIFPN.lateral_convs.0.conv.weight: copying a param with shape torch.Size([88, 40, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 40, 1, 1]).

    Demo error:size mismatch for BIFPN.lateral_convs.0.conv.weight: copying a param with shape torch.Size([88, 40, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 40, 1, 1]).

    Load pretrained Model
    0    BlockArgs(kernel_size=3, num_repeat=2, input_filters=32, output_filters=16, expand_ratio=1, id_skip=True, stride=[1], se_ratio=0.25)
    0    BlockArgs(kernel_size=3, num_repeat=2, input_filters=16, output_filters=16, expand_ratio=1, id_skip=True, stride=1, se_ratio=0.25)
    1    BlockArgs(kernel_size=3, num_repeat=3, input_filters=16, output_filters=24, expand_ratio=6, id_skip=True, stride=[2], se_ratio=0.25)
    1    BlockArgs(kernel_size=3, num_repeat=3, input_filters=24, output_filters=24, expand_ratio=6, id_skip=True, stride=1, se_ratio=0.25)
    1    BlockArgs(kernel_size=3, num_repeat=3, input_filters=24, output_filters=24, expand_ratio=6, id_skip=True, stride=1, se_ratio=0.25)
    2    BlockArgs(kernel_size=5, num_repeat=3, input_filters=24, output_filters=40, expand_ratio=6, id_skip=True, stride=[2], se_ratio=0.25)
    2    BlockArgs(kernel_size=5, num_repeat=3, input_filters=40, output_filters=40, expand_ratio=6, id_skip=True, stride=1, se_ratio=0.25)
    2    BlockArgs(kernel_size=5, num_repeat=3, input_filters=40, output_filters=40, expand_ratio=6, id_skip=True, stride=1, se_ratio=0.25)
    3    BlockArgs(kernel_size=3, num_repeat=4, input_filters=40, output_filters=80, expand_ratio=6, id_skip=True, stride=[2], se_ratio=0.25)
    3    BlockArgs(kernel_size=3, num_repeat=4, input_filters=80, output_filters=80, expand_ratio=6, id_skip=True, stride=1, se_ratio=0.25)
    3    BlockArgs(kernel_size=3, num_repeat=4, input_filters=80, output_filters=80, expand_ratio=6, id_skip=True, stride=1, se_ratio=0.25)
    3    BlockArgs(kernel_size=3, num_repeat=4, input_filters=80, output_filters=80, expand_ratio=6, id_skip=True, stride=1, se_ratio=0.25)
    4    BlockArgs(kernel_size=5, num_repeat=4, input_filters=80, output_filters=112, expand_ratio=6, id_skip=True, stride=[2], se_ratio=0.25)
    4    BlockArgs(kernel_size=5, num_repeat=4, input_filters=112, output_filters=112, expand_ratio=6, id_skip=True, stride=1, se_ratio=0.25)
    4    BlockArgs(kernel_size=5, num_repeat=4, input_filters=112, output_filters=112, expand_ratio=6, id_skip=True, stride=1, se_ratio=0.25)
    4    BlockArgs(kernel_size=5, num_repeat=4, input_filters=112, output_filters=112, expand_ratio=6, id_skip=True, stride=1, se_ratio=0.25)
    5    BlockArgs(kernel_size=5, num_repeat=5, input_filters=112, output_filters=192, expand_ratio=6, id_skip=True, stride=[2], se_ratio=0.25)
    5    BlockArgs(kernel_size=5, num_repeat=5, input_filters=192, output_filters=192, expand_ratio=6, id_skip=True, stride=1, se_ratio=0.25)
    5    BlockArgs(kernel_size=5, num_repeat=5, input_filters=192, output_filters=192, expand_ratio=6, id_skip=True, stride=1, se_ratio=0.25)
    5    BlockArgs(kernel_size=5, num_repeat=5, input_filters=192, output_filters=192, expand_ratio=6, id_skip=True, stride=1, se_ratio=0.25)
    5    BlockArgs(kernel_size=5, num_repeat=5, input_filters=192, output_filters=192, expand_ratio=6, id_skip=True, stride=1, se_ratio=0.25)
    6    BlockArgs(kernel_size=3, num_repeat=2, input_filters=192, output_filters=320, expand_ratio=6, id_skip=True, stride=[2], se_ratio=0.25)
    6    BlockArgs(kernel_size=3, num_repeat=2, input_filters=320, output_filters=320, expand_ratio=6, id_skip=True, stride=1, se_ratio=0.25)
    Loaded pretrained weights for efficientnet-b1
    BIFPN in_channels: [40, 80, 112, 192, 320]
    Traceback (most recent call last):
      File "demo.py", line 169, in <module>
        detect = Detect(weights = args.weight)
      File "demo.py", line 63, in __init__
        self.model.load_state_dict(state_dict)
      File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 839, in load_state_dict
        self.__class__.__name__, "\n\t".join(error_msgs)))
    RuntimeError: Error(s) in loading state_dict for EfficientDet:
    	Unexpected key(s) in state_dict: "BIFPN.stack_bifpn_convs.1.w1", "BIFPN.stack_bifpn_convs.1.w2", "BIFPN.stack_bifpn_convs.1.bifpn_convs.0.0.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.0.0.conv.bias", "BIFPN.stack_bifpn_convs.1.bifpn_convs.0.1.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.0.1.conv.bias", "BIFPN.stack_bifpn_convs.1.bifpn_convs.1.0.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.1.0.conv.bias", "BIFPN.stack_bifpn_convs.1.bifpn_convs.1.1.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.1.1.conv.bias", "BIFPN.stack_bifpn_convs.1.bifpn_convs.2.0.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.2.0.conv.bias", "BIFPN.stack_bifpn_convs.1.bifpn_convs.2.1.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.2.1.conv.bias", "BIFPN.stack_bifpn_convs.1.bifpn_convs.3.0.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.3.0.conv.bias", "BIFPN.stack_bifpn_convs.1.bifpn_convs.3.1.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.3.1.conv.bias", "BIFPN.stack_bifpn_convs.1.bifpn_convs.4.0.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.4.0.conv.bias", "BIFPN.stack_bifpn_convs.1.bifpn_convs.4.1.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.4.1.conv.bias", "BIFPN.stack_bifpn_convs.1.bifpn_convs.5.0.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.5.0.conv.bias", "BIFPN.stack_bifpn_convs.1.bifpn_convs.5.1.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.5.1.conv.bias", "BIFPN.stack_bifpn_convs.1.bifpn_convs.6.0.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.6.0.conv.bias", "BIFPN.stack_bifpn_convs.1.bifpn_convs.6.1.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.6.1.conv.bias", "BIFPN.stack_bifpn_convs.1.bifpn_convs.7.0.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.7.0.conv.bias", "BIFPN.stack_bifpn_convs.1.bifpn_convs.7.1.conv.weight", "BIFPN.stack_bifpn_convs.1.bifpn_convs.7.1.conv.bias", "BIFPN.stack_bifpn_convs.2.w1", "BIFPN.stack_bifpn_convs.2.w2", "BIFPN.stack_bifpn_convs.2.bifpn_convs.0.0.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.0.0.conv.bias", "BIFPN.stack_bifpn_convs.2.bifpn_convs.0.1.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.0.1.conv.bias", "BIFPN.stack_bifpn_convs.2.bifpn_convs.1.0.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.1.0.conv.bias", "BIFPN.stack_bifpn_convs.2.bifpn_convs.1.1.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.1.1.conv.bias", "BIFPN.stack_bifpn_convs.2.bifpn_convs.2.0.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.2.0.conv.bias", "BIFPN.stack_bifpn_convs.2.bifpn_convs.2.1.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.2.1.conv.bias", "BIFPN.stack_bifpn_convs.2.bifpn_convs.3.0.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.3.0.conv.bias", "BIFPN.stack_bifpn_convs.2.bifpn_convs.3.1.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.3.1.conv.bias", "BIFPN.stack_bifpn_convs.2.bifpn_convs.4.0.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.4.0.conv.bias", "BIFPN.stack_bifpn_convs.2.bifpn_convs.4.1.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.4.1.conv.bias", "BIFPN.stack_bifpn_convs.2.bifpn_convs.5.0.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.5.0.conv.bias", "BIFPN.stack_bifpn_convs.2.bifpn_convs.5.1.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.5.1.conv.bias", "BIFPN.stack_bifpn_convs.2.bifpn_convs.6.0.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.6.0.conv.bias", "BIFPN.stack_bifpn_convs.2.bifpn_convs.6.1.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.6.1.conv.bias", "BIFPN.stack_bifpn_convs.2.bifpn_convs.7.0.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.7.0.conv.bias", "BIFPN.stack_bifpn_convs.2.bifpn_convs.7.1.conv.weight", "BIFPN.stack_bifpn_convs.2.bifpn_convs.7.1.conv.bias". 
    	size mismatch for BIFPN.lateral_convs.0.conv.weight: copying a param with shape torch.Size([88, 40, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 40, 1, 1]).
    	size mismatch for BIFPN.lateral_convs.0.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.lateral_convs.1.conv.weight: copying a param with shape torch.Size([88, 80, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 80, 1, 1]).
    	size mismatch for BIFPN.lateral_convs.1.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.lateral_convs.2.conv.weight: copying a param with shape torch.Size([88, 112, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 112, 1, 1]).
    	size mismatch for BIFPN.lateral_convs.2.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.lateral_convs.3.conv.weight: copying a param with shape torch.Size([88, 192, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 192, 1, 1]).
    	size mismatch for BIFPN.lateral_convs.3.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.lateral_convs.4.conv.weight: copying a param with shape torch.Size([88, 320, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 320, 1, 1]).
    	size mismatch for BIFPN.lateral_convs.4.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.0.0.conv.weight: copying a param with shape torch.Size([88, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 1, 3, 3]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.0.0.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.0.1.conv.weight: copying a param with shape torch.Size([88, 88, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 256, 1, 1]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.0.1.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.1.0.conv.weight: copying a param with shape torch.Size([88, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 1, 3, 3]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.1.0.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.1.1.conv.weight: copying a param with shape torch.Size([88, 88, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 256, 1, 1]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.1.1.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.2.0.conv.weight: copying a param with shape torch.Size([88, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 1, 3, 3]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.2.0.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.2.1.conv.weight: copying a param with shape torch.Size([88, 88, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 256, 1, 1]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.2.1.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.3.0.conv.weight: copying a param with shape torch.Size([88, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 1, 3, 3]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.3.0.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.3.1.conv.weight: copying a param with shape torch.Size([88, 88, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 256, 1, 1]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.3.1.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.4.0.conv.weight: copying a param with shape torch.Size([88, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 1, 3, 3]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.4.0.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.4.1.conv.weight: copying a param with shape torch.Size([88, 88, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 256, 1, 1]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.4.1.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.5.0.conv.weight: copying a param with shape torch.Size([88, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 1, 3, 3]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.5.0.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.5.1.conv.weight: copying a param with shape torch.Size([88, 88, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 256, 1, 1]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.5.1.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.6.0.conv.weight: copying a param with shape torch.Size([88, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 1, 3, 3]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.6.0.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.6.1.conv.weight: copying a param with shape torch.Size([88, 88, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 256, 1, 1]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.6.1.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.7.0.conv.weight: copying a param with shape torch.Size([88, 1, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 1, 3, 3]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.7.0.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.7.1.conv.weight: copying a param with shape torch.Size([88, 88, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 256, 1, 1]).
    	size mismatch for BIFPN.stack_bifpn_convs.0.bifpn_convs.7.1.conv.bias: copying a param with shape torch.Size([88]) from checkpoint, the shape in current model is torch.Size([256]).
    	size mismatch for regressionModel.conv1.weight: copying a param with shape torch.Size([256, 88, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]).
    	size mismatch for classificationModel.conv1.weight: copying a param with shape torch.Size([256, 88, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]).
    
    
    opened by AlexLuya 3
  • bi fpn without detach

    bi fpn without detach

    I got better result on face detection task with this changes. Overall detach seems strange for me. We add inputs like skip connections and why we need to detach them?

    opened by rydenisbak 3
  • cannot download the efficientnet-b0-355c32eb.pth,is the addr right?

    cannot download the efficientnet-b0-355c32eb.pth,is the addr right?

    Downloading: "http://storage.googleapis.com/public-models/efficientnet/efficientnet-b0-355c32eb.pth" to /home/.cache/torch/checkpoints/efficientnet-b0-355c32eb.pth Traceback (most recent call last):

    raise HTTPError(req.full_url, code, msg, hdrs, fp)
    

    urllib.error.HTTPError: HTTP Error 403: Forbidden

    opened by mathpopo 2
  • train erro(coco data load0)

    train erro(coco data load0)

    0 epoch: start training.... index created! 0 epoch: start training.... Traceback (most recent call last): File "train.py", line 286, in main() File "train.py", line 279, in main args=(ngpus_per_node, args)) File "/home/baijun/home_storage/anaconda3/envs/yolonn/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 167, in spawn while not spawn_context.join(): File "/home/baijun/home_storage/anaconda3/envs/yolonn/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 114, in join raise Exception(msg) Exception:

    -- Process 1 terminated with the following error: Traceback (most recent call last): File "/home/baijun/home_storage/anaconda3/envs/yolonn/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 19, in _wrap fn(i, *args) File "/data/baijun/Projects/EfficientDet-Pytorch/train.py", line 239, in main_worker train(train_loader, model, scheduler, optimizer, epoch, args) File "/data/baijun/Projects/EfficientDet-Pytorch/train.py", line 99, in train for idx, (images, annotations) in enumerate(train_loader): File "/home/baijun/home_storage/anaconda3/envs/yolonn/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 582, in next return self._process_next_batch(batch) File "/home/baijun/home_storage/anaconda3/envs/yolonn/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 606, in _process_next_batch raise Exception("KeyError:" + batch.exc_msg) Exception: KeyError:Traceback (most recent call last): File "/home/baijun/home_storage/anaconda3/envs/yolonn/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/data/baijun/Projects/EfficientDet-Pytorch/datasets/augmentation.py", line 69, in collater imgs = [s['img'] for s in data] File "/data/baijun/Projects/EfficientDet-Pytorch/datasets/augmentation.py", line 69, in imgs = [s['img'] for s in data] KeyError: 'img'

    opened by Jasper-Bai 2
  • [CUDA/CPU ERROR] when I trained on my data, I found this error:

    [CUDA/CPU ERROR] when I trained on my data, I found this error:

    RuntimeError: Caught RuntimeError in replica 0 on device 0. Original Traceback (most recent call last): File "/home/weiqiang/anaconda3/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 60, in _worker output = module(*input, **kwargs) File "/home/weiqiang/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, **kwargs) File "/home/weiqiang/cancer/code/models/efficientdet.py", line 130, in forward P1, P2, P3, P4, P5, P6, P7 = self.efficientnet(inputs) File "/home/weiqiang/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, **kwargs) File "/home/weiqiang/anaconda3/lib/python3.7/site-packages/efficientnet_pytorch/model.py", line 204, in forward P1, P2, P3, P4, P5, P6, P7 = self.extract_features(inputs) File "/home/weiqiang/anaconda3/lib/python3.7/site-packages/efficientnet_pytorch/model.py", line 190, in extract_features x = MBConvBlock(block_args, self._global_params)(x, drop_connect_rate = drop_connect_rate) File "/home/weiqiang/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, **kwargs) File "/home/weiqiang/anaconda3/lib/python3.7/site-packages/efficientnet_pytorch/model.py", line 78, in forward x = self._swish(self._bn1(self._depthwise_conv(x))) File "/home/weiqiang/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, **kwargs) File "/home/weiqiang/anaconda3/lib/python3.7/site-packages/efficientnet_pytorch/utils.py", line 144, in forward x = F.conv2d(x, self.weight, self.bias, self.stride, self.padding, self.dilation, self.groups) RuntimeError: Expected object of backend CUDA but got backend CPU for argument #2 'weight'

    opened by Observerspy 2
  • Purpose of voc0712.py

    Purpose of voc0712.py

    In your voc0712.py, I see 2 return at line 118 and line 129 inside get_item. The return in line 129 seem not to be reached in any case. However in line 118, no labels was return. Is this still correct?

    opened by tienthegainz 1
  • Undefined name: from functools import partial

    Undefined name: from functools import partial

    flake8 testing of https://github.com/toandaominh1997/EfficientDet.Pytorch on Python 3.8.0

    $ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

    ./eval.py:81:32: F821 undefined name 'device'
                images = images.to(device)
                                   ^
    ./eval.py:82:42: F821 undefined name 'device'
                annotations = annotations.to(device)
                                             ^
    ./utils/vis_bbox.py:107:26: F821 undefined name 'label_names'
                label_names= label_names
                             ^
    ./models/bifpn.py:91:17: F821 undefined name 'xavier_init'
                    xavier_init(m, distribution='uniform')
                    ^
    ./models/bifpn.py:167:17: F821 undefined name 'xavier_init'
                    xavier_init(m, distribution='uniform')
                    ^
    ./models/retinahead.py:8:13: F821 undefined name 'partial'
        pfunc = partial(func, **kwargs) if kwargs else func
                ^
    6     F821 undefined name 'device'
    6
    

    https://flake8.pycqa.org/en/latest/user/error-codes.html

    On the flake8 test selection, this PR does not focus on "style violations" (the majority of flake8 error codes that psf/black can autocorrect). Instead these tests are focus on runtime safety and correctness:

    • E9 tests are about Python syntax errors usually raised because flake8 can not build an Abstract Syntax Tree (AST). Often these issues are a sign of unused code or code that has not been ported to Python 3. These would be compile-time errors in a compiled language but in a dynamic language like Python they result in the script halting/crashing on the user.
    • F63 tests are usually about the confusion between identity and equality in Python. Use ==/!= to compare str, bytes, and int literals is the classic case. These are areas where a == b is True but a is b is False (or vice versa). Python >= 3.8 will raise SyntaxWarnings on these instances.
    • F7 tests logic errors and syntax errors in type hints
    • F82 tests are almost always undefined names which are usually a sign of a typo, missing imports, or code that has not been ported to Python 3. These also would be compile-time errors in a compiled language but in Python a NameError is raised which will halt/crash the script on the user.
    opened by cclauss 1
  • Gradient computation error

    Gradient computation error

    Hello When I run the train.py module, I get this error:

    RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [3, 3]], which is output 0 of ReluBackward0, is at version 1; expected version 0 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!

    opened by siaavashZ 2
  • How to download checkpoint_VOC_efficientdet-d1_34.pth

    How to download checkpoint_VOC_efficientdet-d1_34.pth

    Hi, everyone~

    It seems that the url for downloading the pretrained weights is broken. So how can I download the pretrained model checkpoint_VOC_efficientdet-d0_268.pth or checkpoint_VOC_efficientdet-d1_34.pth?

    Thanks!

    opened by OwalnutO 1
  • urllib.error.HTTPError: HTTP Error 403: Forbidden

    urllib.error.HTTPError: HTTP Error 403: Forbidden

    (venv) jake@jake-ubuntu:~/Gits/EfficientDet.Pytorch$ python train.py --network efficientdet-d0  # Example
    train.py:302: UserWarning: You have chosen to seed training. This will turn on the CUDNN deterministic setting, which can slow down your training considerably! You may see unexpected behavior when restarting from checkpoints.
      warnings.warn('You have chosen to seed training. '
    Downloading: "http://storage.googleapis.com/public-models/efficientnet/efficientnet-b0-355c32eb.pth" to /home/jake/.cache/torch/hub/checkpoints/efficientnet-b0-355c32eb.pth
    Traceback (most recent call last):
      File "train.py", line 333, in <module>
        main()
      File "train.py", line 329, in main
        main_worker(args.gpu, ngpus_per_node, args)
      File "train.py", line 232, in main_worker
        D_class=EFFICIENTDET[args.network]['D_class']
      File "/home/jake/Gits/EfficientDet.Pytorch/models/efficientdet.py", line 33, in __init__
        self.backbone = EfficientNet.from_pretrained(MODEL_MAP[network])
      File "/home/jake/Gits/EfficientDet.Pytorch/models/efficientnet.py", line 243, in from_pretrained
        model, model_name, load_fc=(num_classes == 1000))
      File "/home/jake/Gits/EfficientDet.Pytorch/models/utils.py", line 319, in load_pretrained_weights
        state_dict = model_zoo.load_url(url_map[model_name])
      File "/home/jake/venv/lib/python3.6/site-packages/torch/hub.py", line 483, in load_state_dict_from_url
        download_url_to_file(url, cached_file, hash_prefix, progress=progress)
      File "/home/jake/venv/lib/python3.6/site-packages/torch/hub.py", line 381, in download_url_to_file
        u = urlopen(req)
      File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
        return opener.open(url, data, timeout)
      File "/usr/lib/python3.6/urllib/request.py", line 532, in open
        response = meth(req, response)
      File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
        'http', request, response, code, msg, hdrs)
      File "/usr/lib/python3.6/urllib/request.py", line 570, in error
        return self._call_chain(*args)
      File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
        result = func(*args)
      File "/usr/lib/python3.6/urllib/request.py", line 650, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 403: Forbidden
    
    opened by SlowMonk 2
  • When is TorchScript planed?

    When is TorchScript planed?

    I have seen on your ToDo you plan TorchScript compatibility? Can you indicate a timeline for this? I can not support directly, but if I could donate something let me know...

    opened by thhart 1
Owner
tonne
Machine Learning, Deep Learning, Graph Representation Learning, Reinforcement Learning
tonne
Official PyTorch implementation of Joint Object Detection and Multi-Object Tracking with Graph Neural Networks

This is the official PyTorch implementation of our paper: "Joint Object Detection and Multi-Object Tracking with Graph Neural Networks". Our project website and video demos are here.

Richard Wang 443 Dec 6, 2022
PyTorch implementation of 'Gen-LaneNet: a generalized and scalable approach for 3D lane detection'

(pytorch) Gen-LaneNet: a generalized and scalable approach for 3D lane detection Introduction This is a pytorch implementation of Gen-LaneNet, which p

Yuliang Guo 233 Jan 6, 2023
Hybrid CenterNet - Hybrid-supervised object detection / Weakly semi-supervised object detection

Hybrid-Supervised Object Detection System Object detection system trained by hybrid-supervision/weakly semi-supervision (HSOD/WSSOD): This project is

null 5 Dec 10, 2022
Yolo object detection - Yolo object detection with python

How to run download required files make build_image make download Docker versio

null 3 Jan 26, 2022
(JMLR'19) A Python Toolbox for Scalable Outlier Detection (Anomaly Detection)

Python Outlier Detection (PyOD) Deployment & Documentation & Stats Build Status & Coverage & Maintainability & License PyOD is a comprehensive and sca

Yue Zhao 6.6k Jan 3, 2023
Segcache: a memory-efficient and scalable in-memory key-value cache for small objects

Segcache: a memory-efficient and scalable in-memory key-value cache for small objects This repo contains the code of Segcache described in the followi

TheSys Group @ CMU CS 78 Jan 7, 2023
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 testing data for various deep learning projects such as 6D object pose estimation projects singleshotpose, as well as object detection and instance segmentation projects.

null 305 Dec 16, 2022
Efficient-GlobalPointer - Pytorch Efficient GlobalPointer

引言 感谢苏神带来的模型,原文地址:https://spaces.ac.cn/archives/8877 如何运行 对应模型EfficientGlobalPoi

powerycy 40 Dec 14, 2022
A unofficial pytorch implementation of PAN(PSENet2): Efficient and Accurate Arbitrary-Shaped Text Detection with Pixel Aggregation Network

Efficient and Accurate Arbitrary-Shaped Text Detection with Pixel Aggregation Network Requirements pytorch 1.1+ torchvision 0.3+ pyclipper opencv3 gcc

zhoujun 400 Dec 26, 2022
Object tracking and object detection is applied to track golf puts in real time and display stats/games.

Putting_Game Object tracking and object detection is applied to track golf puts in real time and display stats/games. Works best with the Perfect Prac

Max 1 Dec 29, 2021
Implementation of "GNNAutoScale: Scalable and Expressive Graph Neural Networks via Historical Embeddings" in PyTorch

PyGAS: Auto-Scaling GNNs in PyG PyGAS is the practical realization of our G NN A uto S cale (GAS) framework, which scales arbitrary message-passing GN

Matthias Fey 139 Dec 25, 2022
PyTorch implementation of Advantage Actor Critic (A2C), Proximal Policy Optimization (PPO), Scalable trust-region method for deep reinforcement learning using Kronecker-factored approximation (ACKTR) and Generative Adversarial Imitation Learning (GAIL).

PyTorch implementation of Advantage Actor Critic (A2C), Proximal Policy Optimization (PPO), Scalable trust-region method for deep reinforcement learning using Kronecker-factored approximation (ACKTR) and Generative Adversarial Imitation Learning (GAIL).

Ilya Kostrikov 3k Dec 31, 2022
Object Detection and Multi-Object Tracking

Object Detection and Multi-Object Tracking

Bobby Chen 1.6k Jan 4, 2023
Auto-Lama combines object detection and image inpainting to automate object removals

Auto-Lama Auto-Lama combines object detection and image inpainting to automate object removals. It is build on top of DE:TR from Facebook Research and

null 44 Dec 9, 2022
PyDeepFakeDet is an integrated and scalable tool for Deepfake detection.

PyDeepFakeDet An integrated and scalable library for Deepfake detection research. Introduction PyDeepFakeDet is an integrated and scalable Deepfake de

Junke, Wang 49 Dec 11, 2022
Scalable Attentive Sentence-Pair Modeling via Distilled Sentence Embedding (AAAI 2020) - PyTorch Implementation

Scalable Attentive Sentence-Pair Modeling via Distilled Sentence Embedding PyTorch implementation for the Scalable Attentive Sentence-Pair Modeling vi

Microsoft 25 Dec 2, 2022
A PyTorch Implementation of "SINE: Scalable Incomplete Network Embedding" (ICDM 2018).

Scalable Incomplete Network Embedding ⠀⠀ A PyTorch implementation of Scalable Incomplete Network Embedding (ICDM 2018). Abstract Attributed network em

Benedek Rozemberczki 69 Sep 22, 2022