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

Fix roibugs #42

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ FAIR Dataset: [fair.md](docs/fair.md)

SSDD/SSDD+: [ssdd.md](docs/ssdd.md)

HRSC2016: [hrsc2016.md](docs/hrsc2016.md)

You can also build your own dataset by convert your datas to DOTA format.
### Config
JDet defines the used model, dataset and training/testing method by `config-file`, please check the [config.md](docs/config.md) to learn how it works.
Expand Down
7 changes: 4 additions & 3 deletions configs/faster_rcnn_RoITrans_r50_fpn_1x_dota.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
workers_per_gpu=2,
train=dict(
type=dataset_type,
dataset_dir='/home/cxjyxx_me/workspace/JAD/datasets/processed_DOTA/trainval_1024_200_1.0',
dataset_dir='/home/flowey/dataset/processed_DOTA/trainval_1024_200_1.0/',
version='1',
filter_min_size=32,
transforms=[
Expand All @@ -163,10 +163,11 @@
to_bgr=True),
],
batch_size=2,
shuffle=True,
),
val=dict(
type=dataset_type,
dataset_dir='/home/cxjyxx_me/workspace/JAD/datasets/processed_DOTA/trainval_1024_200_1.0',
dataset_dir='/home/flowey/dataset/processed_DOTA/trainval_1024_200_1.0/',
version='1',
filter_min_size=32,
transforms=[
Expand All @@ -182,7 +183,7 @@
),
test=dict(
type="ImageDataset",
images_dir='/mnt/disk/lxl/dataset/DOTA_1024/test_split/images/',
images_dir='/home/flowey/dataset/processed_DOTA/test_1024_200_1.0/images',
transforms=[
dict(
type = "Pad",
Expand Down
23 changes: 23 additions & 0 deletions configs/preprocess/hrsc2016_preprocess_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
type='HRSC2016'
source_dataset_path='/home/flowey/dataset/HRSC2016'

tasks=[
dict(
label='train',
config=dict(
images_path=source_dataset_path+'/Train/AllImages',
xml_path=source_dataset_path+'/Train/Annotations',
imageset_file=source_dataset_path+'/Train/train.txt',
out_annotation_file=source_dataset_path+'/Train/labels.pkl',
)
),
dict(
label='test',
config=dict(
images_path=source_dataset_path+'/Test/AllImages',
xml_path=source_dataset_path+'/Test/Annotations',
imageset_file=source_dataset_path+'/Test/test.txt',
out_annotation_file=source_dataset_path+'/Test/labels.pkl',
)
)
]
183 changes: 183 additions & 0 deletions configs/s2anet/s2anet_r50_fpn_3x_hrsc2016.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
# model settings
model = dict(
type='S2ANet',
backbone=dict(
type='Resnet50',
frozen_stages=1,
return_stages=["layer1","layer2","layer3","layer4"],
pretrained= True),
neck=dict(
type='FPN',
in_channels=[256, 512, 1024, 2048],
out_channels=256,
start_level=1,
add_extra_convs="on_input",
num_outs=5),
bbox_head=dict(
type='S2ANetHead',
num_classes=2,
in_channels=256,
feat_channels=256,
stacked_convs=2,
with_orconv=True,
anchor_ratios=[1.0],
anchor_strides=[8, 16, 32, 64, 128],
anchor_scales=[4],
target_means=[.0, .0, .0, .0, .0],
target_stds=[1.0, 1.0, 1.0, 1.0, 1.0],
loss_fam_cls=dict(
type='FocalLoss',
use_sigmoid=True,
gamma=2.0,
alpha=0.25,
loss_weight=1.0),
loss_fam_bbox=dict(
type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0),
loss_odm_cls=dict(
type='FocalLoss',
use_sigmoid=True,
gamma=2.0,
alpha=0.25,
loss_weight=1.0),
loss_odm_bbox=dict(
type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0),
test_cfg=dict(
nms_pre=2000,
min_bbox_size=0,
score_thr=0.05,
nms=dict(type='nms_rotated', iou_thr=0.1),
max_per_img=2000),
train_cfg=dict(
fam_cfg=dict(
assigner=dict(
type='MaxIoUAssigner',
pos_iou_thr=0.5,
neg_iou_thr=0.4,
min_pos_iou=0,
ignore_iof_thr=-1,
iou_calculator=dict(type='BboxOverlaps2D_rotated')),
bbox_coder=dict(type='DeltaXYWHABBoxCoder',
target_means=(0., 0., 0., 0., 0.),
target_stds=(1., 1., 1., 1., 1.),
clip_border=True),
allowed_border=-1,
pos_weight=-1,
debug=False),
odm_cfg=dict(
assigner=dict(
type='MaxIoUAssigner',
pos_iou_thr=0.5,
neg_iou_thr=0.4,
min_pos_iou=0,
ignore_iof_thr=-1,
iou_calculator=dict(type='BboxOverlaps2D_rotated')),
bbox_coder=dict(type='DeltaXYWHABBoxCoder',
target_means=(0., 0., 0., 0., 0.),
target_stds=(1., 1., 1., 1., 1.),
clip_border=True),
allowed_border=-1,
pos_weight=-1,
debug=False))
)
)
base_data_root = '/home/flowey/dataset/HRSC2016'
dataset = dict(
train=dict(
type="HRSC2016Dataset",
images_dir = base_data_root + '/Train/AllImages',
annotations_file = base_data_root + '/Train/labels.pkl',
transforms=[
dict(
type="RotatedResize",
min_size=512,
max_size=800
),
dict(type='RotatedRandomFlip', prob=0.5),
dict(
type = "Pad",
size_divisor=32),
dict(
type = "Normalize",
mean = [123.675, 116.28, 103.53],
std = [58.395, 57.12, 57.375],
to_bgr=False,)

],
batch_size=2,
num_workers=4,
shuffle=True,
filter_empty_gt=False
),
val=dict(
type="HRSC2016Dataset",
images_dir = base_data_root + '/Test/AllImages',
annotations_file = base_data_root + '/Test/labels.pkl',
use_07_metric=False,
transforms=[
dict(
type="RotatedResize",
min_size=512,
max_size=800
),
dict(
type = "Pad",
size_divisor=32),
dict(
type = "Normalize",
mean = [123.675, 116.28, 103.53],
std = [58.395, 57.12, 57.375],
to_bgr=False),
],
batch_size=2,
num_workers=4,
shuffle=False
),
test=dict(
type="ImageDataset",
dataset_type="HRSC2016",
images_dir = base_data_root + '/Test/AllImages',
transforms=[
dict(
type="RotatedResize",
min_size=512,
max_size=800
),
dict(
type = "Pad",
size_divisor=32),
dict(
type = "Normalize",
mean = [123.675, 116.28, 103.53],
std = [58.395, 57.12, 57.375],
to_bgr=False,),
],
num_workers=4,
batch_size=2,
)
)

optimizer = dict(
type='SGD',
lr=0.01/4., #0.0,#0.01*(1/8.),
momentum=0.9,
weight_decay=0.0001,
grad_clip=dict(
max_norm=35,
norm_type=2))

scheduler = dict(
type='StepLR',
warmup='linear',
warmup_iters=500,
warmup_ratio=1.0 / 3,
milestones=[24, 33])


logger = dict(
type="RunLogger")

# when we the trained model from cshuan, image is rgb
max_epoch = 36
eval_interval = 1
checkpoint_interval = 1
log_interval = 50
98 changes: 98 additions & 0 deletions configs/san10_pairwise.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
model = dict(
type='SAN',
sa_type=0,
layers=[2, 1, 2, 4, 1],
kernels=[3, 7, 7, 7, 7],
num_classes=1000,
loss=dict(
type='SAMSmoothLoss',
eps=0.1
),
loss_prepare=False
)

# dataset settings
dataset_type = 'ILSVRCDataset'
dataset = dict(
imgs_per_gpu=2,
workers_per_gpu=4,
train=dict(
type=dataset_type,
images_dir='/home/flowey/dataset/ILSVRC2012/train/',
transforms=[
dict(type = "Resize", ## TODO: implement RandomRotatedCrop
min_size = 224,
max_size = 224,
),
dict(
type = "RotatedRandomFlip",
prob = 0.5,
direction="horizontal",
),
dict(
type = "Normalize", ## unknown normalize
mean = [123.675, 116.28, 103.53],
std = [58.395, 57.12, 57.375],
to_bgr=False),
],
batch_size=2,
),
val=dict(
type=dataset_type,
batch_size=100,
images_dir='/home/flowey/dataset/ILSVRC2012/val/',
transforms=[
dict(type = "Resize",
min_size = 256,
max_size = None,
),
dict(type = "CenterCropJt",
size = 224,
),
dict(
type = "Normalize",
mean = [123.675, 116.28, 103.53],
std = [58.395, 57.12, 57.375],
to_bgr=False),
],
),
test=dict(
type="ImageDataset",
images_dir='/mnt/disk/lxl/dataset/DOTA_1024/test_split/images/',
transforms=[
dict(type = "Resize",
min_size = 224,
max_size = 224,
),
dict(
type = "Normalize",
mean = [123.675, 116.28, 103.53],
std = [58.395, 57.12, 57.375],
to_bgr=False),
],
)
)
# optimizer
optimizer = dict(
type='SGD',
lr=0.01,
momentum=0.9,
weight_decay=0.0001,
grad_clip=dict( ##grad_clip: not sure
max_norm=35,
norm_type=2))

# learning policy
scheduler = dict(
type='CosineAnnealingLR',
warmup='linear', ##warmup: not sure
warmup_iters=500,
warmup_ratio=1.0 / 3,
max_steps=100)

logger = dict(
type="RunLogger")
max_epoch = 100
eval_interval = 25
checkpoint_interval = 10
log_interval = 20
Loading