Skip to content

Commit

Permalink
update pytorchcv.
Browse files Browse the repository at this point in the history
  • Loading branch information
youdonny committed Jan 10, 2019
1 parent 141c0d2 commit 3705979
Show file tree
Hide file tree
Showing 346 changed files with 6,974 additions and 27,753 deletions.
4 changes: 4 additions & 0 deletions BUGS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Bugs with PyTorchCV

- Backbone with pretrained parameters is initialized, too.

29 changes: 12 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
# PyTorchCV: A PyTorch-Based Framework for Deep Learning in Computer Vision
```
@misc{CV2018,
author = {Donny You & SIGAI (www.sigai.cn)},
howpublished = {\url{https://github.com/CVBox/PyTorchCV}},
author = {Donny You ([email protected])},
howpublished = {\url{https://github.com/youansheng/PyTorchCV}},
year = {2018}
}
```

  This repository provides source code for some deep learning based cv problems. We'll do our best to keep this repository up to date. If you do find a problem about this repository, please raise it as an issue. We will fix it immediately.

  SIGAI, aiming to develop AI framework for Everyone. Please visit [www.sigai.cn](http://www.sigai.cn/)
<div align="center">
<img src="docs/_static/sigai.png" width="300px"/>
</div>
This repository provides source code for some deep learning based cv problems. We'll do our best to keep this repository up to date. If you do find a problem about this repository, please raise it as an issue. We will fix it immediately.


## Implemented Papers

- [Image Classification](https://github.com/CVBox/PyTorchCV/tree/master/methods/cls)
- [Image Classification](https://github.com/youansheng/PyTorchCV/tree/master/methods/cls)
- VGG: Very Deep Convolutional Networks for Large-Scale Image Recognition
- ResNet: Deep Residual Learning for Image Recognition
- DenseNet: Densely Connected Convolutional Networks
Expand All @@ -27,22 +22,22 @@
- ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices
- ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design

- [Semantic Segmentation](https://github.com/CVBox/PyTorchCV/tree/master/methods/seg)
- [Semantic Segmentation](https://github.com/youansheng/PyTorchCV/tree/master/methods/seg)
- DeepLabV3: Rethinking Atrous Convolution for Semantic Image Segmentation
- PSPNet: Pyramid Scene Parsing Network
- DenseASPP: DenseASPP for Semantic Segmentation in Street Scenes

- [Object Detection](https://github.com/CVBox/PyTorchCV/tree/master/methods/det)
- [Object Detection](https://github.com/youansheng/PyTorchCV/tree/master/methods/det)
- SSD: Single Shot MultiBox Detector
- Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks
- YOLOv3: An Incremental Improvement
- FPN: Feature Pyramid Networks for Object Detection

- [Pose Estimation](https://github.com/CVBox/PyTorchCV/tree/master/methods/pose)
- [Pose Estimation](https://github.com/youansheng/PyTorchCV/tree/master/methods/pose)
- CPM: Convolutional Pose Machines
- OpenPose: Realtime Multi-Person 2D Pose Estimation using Part Affinity Fields

- [Instance Segmentation](https://github.com/CVBox/PyTorchCV/tree/master/methods/seg)
- [Instance Segmentation](https://github.com/youansheng/PyTorchCV/tree/master/methods/seg)
- Mask R-CNN


Expand All @@ -57,24 +52,24 @@
| Model | Backbone | Training data | Testing data | mIOU | Pixel Acc | Setting |
|--------|:---------:|:------:|:------:|:------:|:------:|:------:|
| [PSPNet Origin](https://github.com/hszhao/PSPNet) | 3x3-ResNet101 | ADE20K train | ADE20K val | 41.96 | 80.64 | - |
| [PSPNet Ours](https://drive.google.com/open?id=1Q6oYBpq9Y53z_CJz7Km9BaiSVJjcHP4h) | [7x7-ResNet101](https://drive.google.com/open?id=1ROewKyaGPynox_-a50wHkSv1-0jYWyvc) | ADE20K train | ADE20K val | 44.18 | 80.91 | [PSPNet](https://github.com/CVBox/PyTorchCV/blob/master/hypes/seg/ade20k/fs_pspnet_ade20k_seg.json) |
| [PSPNet Ours](https://drive.google.com/open?id=1Q6oYBpq9Y53z_CJz7Km9BaiSVJjcHP4h) | [7x7-ResNet101](https://drive.google.com/open?id=1ROewKyaGPynox_-a50wHkSv1-0jYWyvc) | ADE20K train | ADE20K val | 44.18 | 80.91 | [PSPNet](https://github.com/youansheng/PyTorchCV/blob/master/hypes/seg/ade20k/fs_pspnet_ade20k_seg.json) |

#### Object Detection
- SSD: Single Shot MultiBox Detector

| Model | Backbone | Training data | Testing data | mAP | FPS | Setting |
|--------|:-------:|:---------:|:------:|:------:|:------:|:------:|
| [SSD-300 Origin](https://github.com/weiliu89/caffe/tree/ssd) | VGG16 | VOC07+12 trainval | VOC07 test | 0.772 | - | - |
| [SSD-300 Ours](https://drive.google.com/open?id=15J5blVyZq7lqCePh-Q8S2pxim3-f_8LP) | [VGG16](https://drive.google.com/open?id=1nM0UwmqR4lIHzmRWvs71jfP_gAekjuKy) | VOC07+12 trainval | VOC07 test | 0.786 | - | [SSD300](https://github.com/CVBox/PyTorchCV/blob/master/hypes/det/voc/ssd_vgg300_voc_det.json) |
| [SSD-300 Ours](https://drive.google.com/open?id=15J5blVyZq7lqCePh-Q8S2pxim3-f_8LP) | [VGG16](https://drive.google.com/open?id=1nM0UwmqR4lIHzmRWvs71jfP_gAekjuKy) | VOC07+12 trainval | VOC07 test | 0.786 | - | [SSD300](https://github.com/youansheng/PyTorchCV/blob/master/hypes/det/voc/ssd_vgg300_voc_det.json) |
| [SSD-512 Origin](https://github.com/weiliu89/caffe/tree/ssd) | VGG16 | VOC07+12 trainval | VOC07 test | 0.798 | - | - |
| [SSD-512 Ours](https://drive.google.com/open?id=1RF5gnqfiyz-EcSFU1OSK7tNuX_VRObVW) | [VGG16](https://drive.google.com/open?id=1nM0UwmqR4lIHzmRWvs71jfP_gAekjuKy) | VOC07+12 trainval | VOC07 test | 0.808 | - | [SSD512](https://github.com/CVBox/PyTorchCV/blob/master/hypes/det/voc/ssd_vgg512_voc_det.json) |
| [SSD-512 Ours](https://drive.google.com/open?id=1RF5gnqfiyz-EcSFU1OSK7tNuX_VRObVW) | [VGG16](https://drive.google.com/open?id=1nM0UwmqR4lIHzmRWvs71jfP_gAekjuKy) | VOC07+12 trainval | VOC07 test | 0.808 | - | [SSD512](https://github.com/youansheng/PyTorchCV/blob/master/hypes/det/voc/ssd_vgg512_voc_det.json) |

- Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks

| Model | Backbone | Training data | Testing data | mAP | FPS | Setting |
|--------|:--------:|:---------:|:------:|:------:|:------:|:------:|
| [Faster R-CNN Origin](https://github.com/rbgirshick/py-faster-rcnn) | VGG16 | VOC07 trainval | VOC07 test | 0.699 | - | - |
| [Faster R-CNN Ours](https://drive.google.com/open?id=15SfklRiI1McVWEq9EAceznK-9sxXSQR4) | [VGG16](https://drive.google.com/open?id=1ZL9SS9KRzsDQhMe8kyPQ1LHA60wx_Vcj) | VOC07 trainval | VOC07 test | 0.706 | - | [Faster R-CNN](https://github.com/CVBox/PyTorchCV/blob/master/hypes/det/voc/fr_vgg16_voc_det.json) |
| [Faster R-CNN Ours](https://drive.google.com/open?id=15SfklRiI1McVWEq9EAceznK-9sxXSQR4) | [VGG16](https://drive.google.com/open?id=1ZL9SS9KRzsDQhMe8kyPQ1LHA60wx_Vcj) | VOC07 trainval | VOC07 test | 0.706 | - | [Faster R-CNN](https://github.com/youansheng/PyTorchCV/blob/master/hypes/det/voc/fr_vgg16_voc_det.json) |

- YOLOv3: An Incremental Improvement

Expand Down
2 changes: 1 addition & 1 deletion datasets/cls/cifar/cifar_cls_generator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Donny You(donnyyou@163.com)
# Author: Donny You(youansheng@gmail.com)


from __future__ import print_function
Expand Down
2 changes: 1 addition & 1 deletion datasets/cls/cifar/cifar_cls_generator.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# -*- coding:utf-8 -*-
# Author: Donny You(donnyyou@163.com)
# Author: Donny You(youansheng@gmail.com)
# Generate train & val data.


Expand Down
9 changes: 6 additions & 3 deletions datasets/cls/fc_data_loader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Donny You(donnyyou@163.com)
# Author: Donny You(youansheng@gmail.com)
# Data loader for Image Classification.


Expand All @@ -10,9 +10,9 @@

import json
import os

import torch.utils.data as data

from extensions.parallel.data_container import DataContainer
from utils.helpers.image_helper import ImageHelper


Expand All @@ -37,7 +37,10 @@ def __getitem__(self, index):
if self.img_transform is not None:
img = self.img_transform(img)

return img, label
return dict(
img=DataContainer(img, stack=True),
label=DataContainer(label, stack=True),
)

def __len__(self):

Expand Down
2 changes: 1 addition & 1 deletion datasets/cls/flower/flower_cls_generator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Donny You(donnyyou@163.com)
# Author: Donny You(youansheng@gmail.com)
# KITTI det data generator.


Expand Down
2 changes: 1 addition & 1 deletion datasets/cls/flower/flower_cls_generator.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# -*- coding:utf-8 -*-
# Author: Donny You(donnyyou@163.com)
# Author: Donny You(youansheng@gmail.com)
# Generate train & val data.


Expand Down
2 changes: 1 addition & 1 deletion datasets/cls/imagenet/imagenet_cls_generator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Donny You(donnyyou@163.com)
# Author: Donny You(youansheng@gmail.com)
# KITTI det data generator.


Expand Down
2 changes: 1 addition & 1 deletion datasets/cls/imagenet/imagenet_cls_generator.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# -*- coding:utf-8 -*-
# Author: Donny You(donnyyou@163.com)
# Author: Donny You(youansheng@gmail.com)
# Generate train & val data.


Expand Down
16 changes: 8 additions & 8 deletions datasets/cls_data_loader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Donny You(donnyyou@163.com)
# Author: Donny You(youansheng@gmail.com)
# Class for the Pose Data Loader.


Expand All @@ -15,7 +15,7 @@
import datasets.tools.cv2_aug_transforms as cv2_aug_trans
import datasets.tools.transforms as trans
from datasets.cls.fc_data_loader import FCDataLoader
from datasets.tools.collate_functions import CollateFunctions
from datasets.tools.collate import collate
from utils.tools.logger import Logger as Log


Expand Down Expand Up @@ -54,9 +54,9 @@ def get_trainloader(self):
img_transform=self.img_transform, configer=self.configer),
batch_size=self.configer.get('train', 'batch_size'), shuffle=True,
num_workers=self.configer.get('data', 'workers'), pin_memory=True,
collate_fn=lambda *args: CollateFunctions.our_collate(
*args, data_keys=['img', 'label'],
trans_dict=self.configer.get('train', 'data_transformer')
drop_last=self.configer.get('data', 'drop_last'),
collate_fn=lambda *args: collate(
*args, trans_dict=self.configer.get('train', 'data_transformer')
)
)

Expand All @@ -74,9 +74,9 @@ def get_valloader(self):
img_transform=self.img_transform, configer=self.configer),
batch_size=self.configer.get('val', 'batch_size'), shuffle=False,
num_workers=self.configer.get('data', 'workers'), pin_memory=True,
collate_fn=lambda *args: CollateFunctions.our_collate(
*args, data_keys=['img', 'label'],
trans_dict=self.configer.get('val', 'data_transformer')
drop_last=self.configer.get('data', 'drop_last'),
collate_fn=lambda *args: collate(
*args, trans_dict=self.configer.get('val', 'data_transformer')
)
)

Expand Down
90 changes: 0 additions & 90 deletions datasets/det/aa_data_loader.py

This file was deleted.

2 changes: 1 addition & 1 deletion datasets/det/coco/coco_det_generator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Donny You(donnyyou@163.com)
# Author: Donny You(youansheng@gmail.com)
# COCO det data generator.


Expand Down
2 changes: 1 addition & 1 deletion datasets/det/coco/coco_det_generator.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# -*- coding:utf-8 -*-
# Author: Donny You(donnyyou@163.com)
# Author: Donny You(youansheng@gmail.com)
# Generate train & val data.


Expand Down
2 changes: 1 addition & 1 deletion datasets/det/fashion/fashion_det_generator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Donny You(donnyyou@163.com)
# Author: Donny You(youansheng@gmail.com)
# Fashion det data generator.


Expand Down
2 changes: 1 addition & 1 deletion datasets/det/fashion/fashion_det_generator.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# -*- coding:utf-8 -*-
# Author: Donny You(donnyyou@163.com)
# Author: Donny You(youansheng@gmail.com)
# Generate train & val data.


Expand Down
21 changes: 15 additions & 6 deletions datasets/det/fr_data_loader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Donny You(donnyyou@163.com)
# Author: Donny You(youansheng@gmail.com)
# Faster R-CNN data loader


Expand All @@ -13,6 +13,7 @@
import numpy as np
import torch.utils.data as data

from extensions.parallel.data_container import DataContainer
from utils.helpers.json_helper import JsonHelper
from utils.helpers.image_helper import ImageHelper
from utils.tools.logger import Logger as Log
Expand All @@ -39,17 +40,25 @@ def __getitem__(self, index):
if self.aug_transform is not None:
img, bboxes, labels = self.aug_transform(img, bboxes=bboxes, labels=labels)

img_scale = ImageHelper.get_size(img)[0] / img_size[0]

labels = torch.from_numpy(labels).long()
bboxes = torch.from_numpy(bboxes).float()

scale1 = 600 / min(img_size)
scale2 = 1000 / max(img_size)
scale = min(scale1, scale2)

meta = dict(
ori_img_size=img_size,
aug_img_size=ImageHelper.get_size(img),
img_scale=img_scale,
)
if self.img_transform is not None:
img = self.img_transform(img)

return img, scale, bboxes, labels
return dict(
img=DataContainer(img, stack=True),
bboxes=DataContainer(bboxes, stack=False),
labels=DataContainer(labels, stack=False),
meta=DataContainer(meta, stack=False, cpu_only=True)
)

def __len__(self):

Expand Down
2 changes: 1 addition & 1 deletion datasets/det/kitti/kitti_det_generator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Donny You(donnyyou@163.com)
# Author: Donny You(youansheng@gmail.com)
# KITTI det data generator.


Expand Down
2 changes: 1 addition & 1 deletion datasets/det/kitti/kitti_det_generator.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# -*- coding:utf-8 -*-
# Author: Donny You(donnyyou@163.com)
# Author: Donny You(youansheng@gmail.com)
# Generate train & val data.


Expand Down
Loading

0 comments on commit 3705979

Please sign in to comment.