Skip to content

Commit

Permalink
Merge branch 'master' of github.com:alibaba/EasyCV
Browse files Browse the repository at this point in the history
  • Loading branch information
Cathy0908 committed Aug 17, 2023
2 parents b39db6d + 915bb73 commit c4c797d
Show file tree
Hide file tree
Showing 289 changed files with 2,973 additions and 55 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/citest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ concurrency:
jobs:
ut-torch180:
# The type of runner that the job will run on
runs-on: [unittest-t4]
runs-on: [self-hosted]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -64,22 +64,27 @@ jobs:
# pip install -r requirements.txt
#run test
export CUDA_VISIBLE_DEVICES=7
source ~/workspace/anaconda2/etc/profile.d/conda.sh
source ~/anaconda3/etc/profile.d/conda.sh
conda activate easycv_torch1.8.0
# pip install pai-easycv
pip uninstall -y pai-easycv
python setup.py install
python setup.py sdist bdist_wheel
# move source code, ensure import easycv from site-package
mv ./easycv ./easycv_src
PYTHONPATH=. python tests/run.py
PYTHONPATH=. python tests/run.py --skip_dir tests/test_toolkit/modelscope
conda activate easycv_torch1.8.0_py37
PYTHONPATH=. python tests/run.py --test_dir tests/test_toolkit/modelscope
# blade test env will be updated! we do not support test with trt_efficient_nms
ut-torch181-blade:
# The type of runner that the job will run on
runs-on: [unittest-t4]
runs-on: [self-hosted]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -105,7 +110,7 @@ jobs:
# pip install -r requirements.txt
#run test
export CUDA_VISIBLE_DEVICES=6
source ~/workspace/anaconda2/etc/profile.d/conda.sh
source ~/anaconda3/etc/profile.d/conda.sh
conda activate torch1.8.1_blade
PYTHONPATH=. python tests/predictors/test_detector_blade.py
PYTHONPATH=. python tests/apis/test_export_blade.py
PYTHONPATH=. python tests/test_predictors/test_detector_blade.py
PYTHONPATH=. python tests/test_apis/test_export_blade.py
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ EasyCV is an all-in-one computer vision toolbox based on PyTorch, mainly focuses


## What's New
[🔥 2023.05.09]

* 09/05/2023 EasyCV v0.11.0 was released.
- Support EasyCV as a plug-in for [modelscope](https://github.com/modelscope/modelscope.

[🔥 2023.03.06]

* 06/03/2023 EasyCV v0.10.0 was released.
Expand Down
5 changes: 5 additions & 0 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ EasyCV是一个涵盖多个领域的基于Pytorch的计算机视觉工具箱,


## 最新进展
[🔥 2023.05.09]

* 09/05/2023 EasyCV v0.11.0 was released.
- 支持EasyCV作为[modelscope](https://github.com/modelscope/modelscope)插件接入模型.

[🔥 2023.03.06]

* 06/03/2023 EasyCV v0.10.0 was released.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
data=data['val'],
dist_eval=True,
evaluators=[
dict(type='ClsEvaluator', topk=(1, 5), class_list=class_list)
dict(type='ClsEvaluator', topk=(1, ), class_list=class_list)
],
)
]
1 change: 1 addition & 0 deletions configs/detection/fcos/coco_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
eval_pipelines = [
dict(
mode='test',
data=data['val'],
evaluators=[
dict(type='CocoDetectionEvaluator', classes=CLASSES),
],
Expand Down
142 changes: 137 additions & 5 deletions configs/segmentation/fcn/fcn_r50-d8_512x512_8xb4_60e_voc12.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,55 @@
_base_ = ['./fcn_r50-d8_512x512_8xb4_60e_voc12aug.py']
_base_ = ['configs/base.py']

# model settings
num_classes = 21

# norm_cfg = dict(type='SyncBN', requires_grad=True) # multi gpus
norm_cfg = dict(type='BN', requires_grad=True)

model = dict(
type='EncoderDecoder',
pretrained='open-mmlab://resnet50_v1c',
backbone=dict(
type='ResNetV1c',
depth=50,
num_stages=4,
out_indices=(1, 2, 3, 4),
dilations=(1, 1, 2, 4),
strides=(1, 2, 1, 1),
norm_cfg=norm_cfg,
norm_eval=False,
style='pytorch',
contract_dilation=True,
),
decode_head=dict(
type='FCNHead',
in_channels=2048,
in_index=3,
channels=512,
num_convs=2,
concat_input=True,
dropout_ratio=0.1,
num_classes=num_classes,
norm_cfg=norm_cfg,
align_corners=False,
loss_decode=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
auxiliary_head=dict(
type='FCNHead',
in_channels=1024,
in_index=2,
channels=256,
num_convs=1,
concat_input=False,
dropout_ratio=0.1,
num_classes=num_classes,
norm_cfg=norm_cfg,
align_corners=False,
loss_decode=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
# model training and testing settings
train_cfg=dict(),
test_cfg=dict(mode='whole'))

CLASSES = [
'background', 'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus',
Expand All @@ -8,21 +59,102 @@

# dataset settings
dataset_type = 'SegDataset'
data_root = 'data/VOCdevkit/VOC2012/'
data_type = 'SegSourceRaw'
data_root = 'data/VOCdevkit/VOC2012'

train_img_root = data_root + 'JPEGImages'
train_label_root = data_root + 'SegmentationClass'
train_list_file = data_root + 'ImageSets/Segmentation/train.txt'

val_img_root = data_root + 'JPEGImages'
val_label_root = data_root + 'SegmentationClass'
val_list_file = data_root + 'ImageSets/Segmentation/val.txt'

test_batch_size = 2

img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)

img_scale = (512, 512)
train_pipeline = [
dict(type='MMResize', img_scale=img_scale, ratio_range=(0.5, 2.0)),
dict(type='SegRandomCrop', crop_size=(512, 512), cat_max_ratio=0.75),
dict(type='MMRandomFlip', flip_ratio=0.5),
dict(type='MMPhotoMetricDistortion'),
dict(type='MMNormalize', **img_norm_cfg),
dict(type='MMPad', size=(512, 512)),
dict(type='DefaultFormatBundle'),
dict(
type='Collect',
keys=['img', 'gt_semantic_seg'],
meta_keys=('filename', 'ori_filename', 'ori_shape', 'img_shape',
'pad_shape', 'scale_factor', 'flip', 'flip_direction',
'img_norm_cfg')),
]
test_pipeline = [
dict(
type='MMMultiScaleFlipAug',
img_scale=img_scale,
# img_ratios=[0.5, 0.75, 1.0, 1.25, 1.5, 1.75],
flip=False,
transforms=[
dict(type='MMResize', keep_ratio=True),
dict(type='MMRandomFlip'),
dict(type='MMNormalize', **img_norm_cfg),
dict(type='ImageToTensor', keys=['img']),
dict(
type='Collect',
keys=['img'],
meta_keys=('filename', 'ori_filename', 'ori_shape',
'img_shape', 'pad_shape', 'scale_factor', 'flip',
'flip_direction', 'img_norm_cfg')),
])
]
data = dict(
imgs_per_gpu=4,
workers_per_gpu=4,
train=dict(
type=dataset_type,
ignore_index=255,
data_source=dict(
_delete_=True,
type='SegSourceRaw',
type=data_type,
img_root=train_img_root,
label_root=train_label_root,
split=train_list_file,
classes=CLASSES),
))
pipeline=train_pipeline),
val=dict(
imgs_per_gpu=test_batch_size,
ignore_index=255,
type=dataset_type,
data_source=dict(
type=data_type,
img_root=val_img_root,
label_root=val_label_root,
split=val_list_file,
classes=CLASSES,
),
pipeline=test_pipeline))

# optimizer
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0005)
optimizer_config = dict()

# learning policy
lr_config = dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=True)

# runtime settings
total_epochs = 60
checkpoint_config = dict(interval=1)
eval_config = dict(interval=1, gpu_collect=False)
eval_pipelines = [
dict(
mode='test',
evaluators=[
dict(
type='SegmentationEvaluator',
classes=CLASSES,
metric_names=['mIoU'])
],
)
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
_base_ = ['configs/base.py']
_base_ = 'configs/base.py'

CLASSES = [
'background', 'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus',
Expand Down
84 changes: 82 additions & 2 deletions configs/segmentation/segformer/segformer_b5_coco.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
_base_ = './segformer_b0_coco.py'

CLASSES = [
'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train',
'truck', 'boat', 'traffic light', 'fire hydrant', 'stop sign',
'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow',
'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag',
'tie', 'suitcase', 'frisbee', 'skis', 'snowboard', 'sports ball', 'kite',
'baseball bat', 'baseball glove', 'skateboard', 'surfboard',
'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon',
'bowl', 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot',
'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', 'potted plant',
'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote',
'keyboard', 'cell phone', 'microwave', 'oven', 'toaster', 'sink',
'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear',
'hair drier', 'toothbrush', 'banner', 'blanket', 'branch', 'bridge',
'building-other', 'bush', 'cabinet', 'cage', 'cardboard', 'carpet',
'ceiling-other', 'ceiling-tile', 'cloth', 'clothes', 'clouds', 'counter',
'cupboard', 'curtain', 'desk-stuff', 'dirt', 'door-stuff', 'fence',
'floor-marble', 'floor-other', 'floor-stone', 'floor-tile', 'floor-wood',
'flower', 'fog', 'food-other', 'fruit', 'furniture-other', 'grass',
'gravel', 'ground-other', 'hill', 'house', 'leaves', 'light', 'mat',
'metal', 'mirror-stuff', 'moss', 'mountain', 'mud', 'napkin', 'net',
'paper', 'pavement', 'pillow', 'plant-other', 'plastic', 'platform',
'playingfield', 'railing', 'railroad', 'river', 'road', 'rock', 'roof',
'rug', 'salad', 'sand', 'sea', 'shelf', 'sky-other', 'skyscraper', 'snow',
'solid-other', 'stairs', 'stone', 'straw', 'structural-other', 'table',
'tent', 'textile-other', 'towel', 'tree', 'vegetable', 'wall-brick',
'wall-concrete', 'wall-other', 'wall-panel', 'wall-stone', 'wall-tile',
'wall-wood', 'water-other', 'waterdrops', 'window-blind', 'window-other',
'wood'
]

model = dict(
pretrained=
'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/segformer/mit_b5_20220624-658746d9.pth',
Expand All @@ -15,9 +46,11 @@

img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)

img_scale = (2048, 640)
crop_size = (640, 640)
train_pipeline = [
dict(type='MMResize', img_scale=(2048, 640), ratio_range=(0.5, 2.0)),
dict(type='MMResize', img_scale=img_scale, ratio_range=(0.5, 2.0)),
dict(type='SegRandomCrop', crop_size=crop_size, cat_max_ratio=0.75),
dict(type='MMRandomFlip', flip_ratio=0.5),
dict(type='MMPhotoMetricDistortion'),
Expand All @@ -34,7 +67,7 @@
test_pipeline = [
dict(
type='MMMultiScaleFlipAug',
img_scale=(2048, 640),
img_scale=img_scale,
# img_ratios=[0.5, 0.75, 1.0, 1.25, 1.5, 1.75],
flip=False,
transforms=[
Expand All @@ -50,3 +83,50 @@
'flip_direction', 'img_norm_cfg')),
])
]

data_root = './data/coco_stuff164k/'
# dataset settings
data_type = 'SegSourceRaw'
data_root = 'data/VOCdevkit/VOC2012'

train_img_root = data_root + 'JPEGImages'
train_label_root = data_root + 'SegmentationClass'
train_list_file = data_root + 'ImageSets/Segmentation/train.txt'

val_img_root = data_root + 'JPEGImages'
val_label_root = data_root + 'SegmentationClass'
val_list_file = data_root + 'ImageSets/Segmentation/val.txt'

test_batch_size = 2

data = dict(
imgs_per_gpu=2,
workers_per_gpu=2,
train=dict(
type='SegDataset',
ignore_index=255,
data_source=dict(
type=data_type,
img_suffix='.jpg',
label_suffix='.png',
img_root=train_img_root,
label_root=train_label_root,
split=train_list_file,
classes=CLASSES,
),
pipeline=train_pipeline),
val=dict(
imgs_per_gpu=test_batch_size,
ignore_index=255,
type='SegDataset',
data_source=dict(
type=data_type,
img_suffix='.jpg',
label_suffix='.png',
img_root=val_img_root,
label_root=val_label_root,
split=val_list_file,
classes=CLASSES,
),
pipeline=test_pipeline),
)
Loading

0 comments on commit c4c797d

Please sign in to comment.