Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adds support of YOLOv4 detection model #78

Merged
merged 51 commits into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
52c06e0
feat: Updated Darknet URLs
frgfm Aug 13, 2020
9f71697
docs: Updated Readmes
frgfm Aug 13, 2020
688a1e0
fix: Fixed backbone norm layer
frgfm Aug 13, 2020
2a2e4c4
feat: Added SPP & PAN layers
frgfm Aug 13, 2020
0042e5b
feat: Added YOLOv4 neck
frgfm Aug 13, 2020
e6fb6f3
style: Fixed lint
frgfm Aug 14, 2020
a0109cf
feat: Added Self Attention Module
frgfm Aug 14, 2020
5dc89b8
docs: Fixed docstring
frgfm Aug 14, 2020
38b2dc4
style: Added extra_repr to GlobalAvgPool2d
frgfm Aug 29, 2020
cc40f72
feat: Added implementation of YOLOv4
frgfm Aug 29, 2020
cb07cb6
refactor: Updated addcdiv usage to reflect torch changes
frgfm Aug 29, 2020
37bfcac
refactor: Switched anchors to buffer
frgfm Aug 29, 2020
d79d76e
style: Fixed lint
frgfm Aug 30, 2020
3eb1bf9
feat: Added compatibility for list of Tensor as input
frgfm Aug 30, 2020
b91aca8
fix: Passed down gt_boxes and gt_labels
frgfm Aug 30, 2020
f3c299b
style: Fixed lint
frgfm Aug 30, 2020
31373e8
refactor: Reshaped model outputs
frgfm Aug 30, 2020
1ba700a
feat: Added implementation of Generalized IoU
frgfm Aug 30, 2020
7b9b359
test: Updated unittests
frgfm Aug 30, 2020
fd74657
docs: Updated documentation
frgfm Aug 30, 2020
2506b15
fix: Fixed YOLOv4 loss
frgfm Aug 30, 2020
da7d936
test: Updated unittests for models
frgfm Aug 30, 2020
563937b
docs: Updated documentation
frgfm Aug 30, 2020
f4abecd
test: Added check to make sure loss can be backpropagated
frgfm Aug 30, 2020
a9e43a9
fix: Fixed YOLO loss
frgfm Aug 30, 2020
8f08d46
docs: Updated docstring
frgfm Aug 30, 2020
345b6d4
feat: Updated default backbone parameters
frgfm Aug 30, 2020
c23d00c
refactor: Refactored loss computation
frgfm Aug 30, 2020
47f9a04
refactor: Updated global avg poolings in models
frgfm Aug 30, 2020
3c91feb
style: Fixed lint
frgfm Aug 30, 2020
e5017cd
fix: Fixed missed import
frgfm Aug 30, 2020
dde6c0b
chore: Fixed imports
frgfm Aug 30, 2020
ff39a36
fix: Fixed typo
frgfm Aug 30, 2020
962f012
refactor: Refactored SPP
frgfm Aug 30, 2020
e728887
fix: Fixed anchor selection
frgfm Aug 30, 2020
e338dfe
refactor: Switched bbox loss to CIoU
frgfm Aug 30, 2020
9f8c5d8
refactor: Moved YOLOv4 to yolo submodule
frgfm Aug 30, 2020
ff3cbd4
docs: Updated readme
frgfm Aug 30, 2020
2ce7716
fix: Fixed YOLO initialization
frgfm Aug 30, 2020
09e05a8
style: Fixed codacy lint
frgfm Aug 30, 2020
a00b34b
fix: Fixed imports
frgfm Aug 30, 2020
53bf735
fix: Fixed YOLO head
frgfm Aug 31, 2020
51a386d
feat: Added zero initialization of last conv
frgfm Aug 31, 2020
4abd66a
refactor: Refactored anchor
frgfm Aug 31, 2020
3ab076e
feat: Added default initialization
frgfm Aug 31, 2020
13cff11
fix: Fixed coordinate scaling
frgfm Aug 31, 2020
5fddac0
fix: Fixed anchor registration
frgfm Aug 31, 2020
a0fa9a5
fix: Fixed YOLOv4 loss
frgfm Aug 31, 2020
73bf7f5
style: Fixed lint
frgfm Aug 31, 2020
94f3555
style: Fixed codacy syntax
frgfm Aug 31, 2020
440fd1f
refactor: Refactored yolo layer
frgfm Aug 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ conda install -c frgfm pylocron
##### Main features

- Classification: [Res2Net](https://arxiv.org/abs/1904.01169) (based on the great [implementation](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/res2net.py) from Ross Wightman), [Darknet-24](https://pjreddie.com/media/files/papers/yolo_1.pdf), [Darknet-19](https://pjreddie.com/media/files/papers/YOLO9000.pdf), [Darknet-53](https://pjreddie.com/media/files/papers/YOLOv3.pdf), [CSPDarknet-53](<https://arxiv.org/abs/1911.11929>), [ResNet](https://arxiv.org/abs/1512.03385), [ResNeXt](https://arxiv.org/abs/1611.05431), [TridentNet](https://arxiv.org/abs/1901.01892), [PyConvResNet](https://arxiv.org/abs/2006.11538), [ReXNet](https://arxiv.org/abs/2007.00992).
- Detection: [YOLOv1](https://pjreddie.com/media/files/papers/yolo_1.pdf), [YOLOv2](https://pjreddie.com/media/files/papers/YOLO9000.pdf)
- Detection: [YOLOv1](https://pjreddie.com/media/files/papers/yolo_1.pdf), [YOLOv2](https://pjreddie.com/media/files/papers/YOLO9000.pdf), [YOLOv4](https://arxiv.org/abs/2004.10934)
- Segmentation: [U-Net](https://arxiv.org/abs/1505.04597), [UNet++](https://arxiv.org/abs/1807.10165), [UNet3+](https://arxiv.org/abs/2004.08790)

### ops
Expand All @@ -89,9 +89,9 @@ conda install -c frgfm pylocron

The project is currently under development, here are the objectives for the next releases:

- [ ] Standardize models: standardize models by task.
- [x] Standardize models: standardize models by task.
- [x] Reference scripts: add reference training scripts
- [ ] Speed benchmark: compare `holocron.nn` functions execution speed.
- [ ] Reference scripts: add reference training scripts



Expand Down
2 changes: 2 additions & 0 deletions docs/source/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ YOLO

.. autofunction:: yolov2

.. autofunction:: yolov4


Semantic Segmentation
=====================
Expand Down
5 changes: 3 additions & 2 deletions docs/source/ops.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ holocron.ops
Boxes
-----

.. autofunction:: box_diou
.. autofunction:: box_ciou
.. autofunction:: box_giou
.. autofunction:: diou_loss
.. autofunction:: ciou_loss
16 changes: 8 additions & 8 deletions holocron/models/darknet.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from ..nn.init import init_module
from .utils import conv_sequence
from .resnet import _ResBlock
from holocron.nn import Mish, DropBlock2d
from holocron.nn import Mish, DropBlock2d, GlobalAvgPool2d


__all__ = ['DarknetV1', 'DarknetV2', 'DarknetV3', 'DarknetV4', 'darknet24', 'darknet19', 'darknet53', 'cspdarknet53']
Expand All @@ -23,13 +23,13 @@
default_cfgs = {
'darknet24': {'arch': 'DarknetV1',
'layout': [[192], [128, 256, 256, 512], [*([256, 512] * 4), 512, 1024], [512, 1024] * 2],
'url': None},
'url': 'https://github.com/frgfm/Holocron/releases/download/v0.1.2/darknet24_224-55729a5c.pth'},
'darknet19': {'arch': 'DarknetV2',
'layout': [(64, 0), (128, 1), (256, 1), (512, 2), (1024, 2)],
'url': None},
'url': 'https://github.com/frgfm/Holocron/releases/download/v0.1.2/darknet19_224-a48304cd.pth'},
'darknet53': {'arch': 'DarknetV3',
'layout': [(64, 1), (128, 2), (256, 8), (512, 8), (1024, 4)],
'url': None},
'url': 'https://github.com/frgfm/Holocron/releases/download/v0.1.2/darknet53_256-f57b8429.pth'},
'cspdarknet53': {'arch': 'DarknetV4',
'layout': [(64, 1), (128, 2), (256, 8), (512, 8), (1024, 4)],
'url': None},
Expand Down Expand Up @@ -73,7 +73,7 @@ def __init__(self, layout, num_classes=10, in_channels=3, stem_channels=64,
super().__init__(OrderedDict([
('features', DarknetBodyV1(layout, in_channels, stem_channels,
act_layer, norm_layer, drop_layer, conv_layer)),
('global_pool', nn.Sequential(nn.AdaptiveAvgPool2d((1, 1)), nn.Flatten())),
('pool', GlobalAvgPool2d(flatten=True)),
('classifier', nn.Linear(layout[2][-1], num_classes))]))

init_module(self, 'leaky_relu')
Expand Down Expand Up @@ -139,7 +139,7 @@ def __init__(self, layout, num_classes=10, in_channels=3, stem_channels=32,
('features', DarknetBodyV2(layout, in_channels, stem_channels, False,
act_layer, norm_layer, drop_layer, conv_layer)),
('classifier', nn.Conv2d(layout[-1][0], num_classes, 1)),
('global_pool', nn.Sequential(nn.AdaptiveAvgPool2d((1, 1)), nn.Flatten()))]))
('pool', GlobalAvgPool2d(flatten=True))]))

init_module(self, 'leaky_relu')

Expand Down Expand Up @@ -208,7 +208,7 @@ def __init__(self, layout, num_classes=10, in_channels=3, stem_channels=32,
super().__init__(OrderedDict([
('features', DarknetBodyV3(layout, in_channels, stem_channels,
act_layer, norm_layer, drop_layer, conv_layer)),
('global_pool', nn.Sequential(nn.AdaptiveAvgPool2d((1, 1)), nn.Flatten())),
('pool', GlobalAvgPool2d(flatten=True)),
('classifier', nn.Linear(layout[-1][0], num_classes))]))

init_module(self, 'leaky_relu')
Expand Down Expand Up @@ -297,7 +297,7 @@ def __init__(self, layout, num_classes=10, in_channels=3, stem_channels=32, num_
super().__init__(OrderedDict([
('features', DarknetBodyV4(layout, in_channels, stem_channels, num_features,
act_layer, norm_layer, drop_layer, conv_layer)),
('global_pool', nn.Sequential(nn.AdaptiveAvgPool2d((1, 1)), nn.Flatten())),
('pool', GlobalAvgPool2d(flatten=True)),
('classifier', nn.Linear(layout[-1][0], num_classes))]))

init_module(self, 'leaky_relu')
Expand Down
Loading