Comments (11)
There is a question that looks forward to your answer
from h2rbox-mmrotate.
I have uploaded the configs for ssdd.
from h2rbox-mmrotate.
15x
is recommended.
from h2rbox-mmrotate.
One possible cause of ModuleNotFoundError: No module named 'h2rbox'
error.
h2rbox-mmrotate/configs/h2rbox/ssdd/h2rbox_r50_fpn_6x_ssdd_le90.py
Lines 121 to 123 in 1f693af
from h2rbox-mmrotate.
Thank you for your patient answer, I'll try it now
from h2rbox-mmrotate.
2022-11-29 14:47:03,279 - mmrotate - INFO - Distributed training: False
2022-11-29 14:47:03,605 - mmrotate - INFO - Config:
dataset_type = 'SARDataset'
data_root = '/data/ssdd/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True),
dict(type='RResize_', img_scale=(800, 800)),
dict(
type='RRandomFlip',
flip_ratio=[0.25, 0.25, 0.25],
direction=['horizontal', 'vertical', 'diagonal'],
version='le90'),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=True),
dict(type='Pad', size_divisor=1),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=(800, 800),
flip=False,
transforms=[
dict(type='RResize'),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=True),
dict(type='Pad', size_divisor=64),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img'])
])
]
data = dict(
samples_per_gpu=2,
workers_per_gpu=2,
train=dict(
type='SARWSOODDataset',
ann_file='/data/ssdd/train/labelTxt/',
img_prefix='/data/ssdd/train/images/',
pipeline=[
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True),
dict(type='RResize_', img_scale=(800, 800)),
dict(
type='RRandomFlip',
flip_ratio=[0.25, 0.25, 0.25],
direction=['horizontal', 'vertical', 'diagonal'],
version='le90'),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=True),
dict(type='Pad', size_divisor=1),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
],
version='le90'),
val=dict(
type='SARWSOODDataset',
ann_file='/data/ssdd/test/inshore/labelTxt/',
img_prefix='/data/ssdd/test/inshore/images/',
pipeline=[
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=(800, 800),
flip=False,
transforms=[
dict(type='RResize'),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=True),
dict(type='Pad', size_divisor=64),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img'])
])
],
version='le90'),
test=dict(
type='SARWSOODDataset',
ann_file='/data/ssdd/test/offshore/labelTxt/',
img_prefix='/data/ssdd/test/offshore/images/',
pipeline=[
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=(800, 800),
flip=False,
transforms=[
dict(type='RResize'),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=True),
dict(type='Pad', size_divisor=64),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img'])
])
],
version='le90'))
evaluation = dict(interval=12, metric='mAP')
optimizer = dict(type='SGD', lr=0.0005, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=500,
warmup_ratio=0.3333333333333333,
step=[48, 66])
runner = dict(type='EpochBasedRunner', max_epochs=72)
checkpoint_config = dict(interval=36)
log_config = dict(
interval=50,
hooks=[dict(type='TextLoggerHook'),
dict(type='TensorboardLoggerHook')])
dist_params = dict(backend='nccl')
log_level = 'INFO'
load_from = None
resume_from = None
workflow = [('train', 1)]
opencv_num_threads = 0
mp_start_method = 'fork'
angle_version = 'le90'
model = dict(
type='H2RBox',
crop_size=(800, 800),
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
zero_init_residual=False,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch',
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
neck=dict(
type='FPN',
in_channels=[256, 512, 1024, 2048],
out_channels=256,
start_level=1,
add_extra_convs='on_output',
num_outs=5,
relu_before_extra_convs=True),
bbox_head=dict(
type='H2RBoxHead',
num_classes=1,
in_channels=256,
stacked_convs=4,
feat_channels=256,
strides=[8, 16, 32, 64, 128],
center_sampling=True,
center_sample_radius=1.5,
norm_on_bbox=True,
centerness_on_reg=True,
separate_angle=False,
scale_angle=True,
reassigner='one2one',
rect_classes=[],
bbox_coder=dict(type='DistanceAnglePointCoder', angle_version='le90'),
loss_cls=dict(
type='FocalLoss',
use_sigmoid=True,
gamma=2.0,
alpha=0.25,
loss_weight=1.0),
loss_bbox=dict(type='IoULoss', loss_weight=1.0),
loss_bbox_aug=dict(
type='H2RBoxLoss',
loss_weight=0.4,
center_loss_cfg=dict(type='L1Loss', loss_weight=0.0),
shape_loss_cfg=dict(type='IoULoss', loss_weight=1.0),
angle_loss_cfg=dict(type='L1Loss', loss_weight=1.0)),
loss_centerness=dict(
type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0)),
train_cfg=None,
test_cfg=dict(
nms_pre=2000,
min_bbox_size=0,
score_thr=0.05,
nms=dict(iou_thr=0.1),
max_per_img=2000))
custom_imports = dict(imports=['h2rbox'], allow_failed_imports=False)
work_dir = './work_dirs/h2rbox_r50_fpn_6x_ssdd_le90'
auto_resume = False
gpu_ids = range(0, 1)
2022-11-29 14:47:03,605 - mmrotate - INFO - Set random seed to 49468598, deterministic: False
2022-11-29 14:47:03,970 - mmrotate - INFO - initialize ResNet with init_cfg {'type': 'Pretrained', 'checkpoint': 'torchvision://resnet50'}
2022-11-29 14:47:03,971 - mmcv - INFO - load model from: torchvision://resnet50
2022-11-29 14:47:03,971 - mmcv - INFO - load checkpoint from torchvision path: torchvision://resnet50
2022-11-29 14:47:04,322 - mmcv - WARNING - The model and loaded state dict do not match exactly
unexpected key in source state_dict: fc.weight, fc.bias
2022-11-29 14:47:04,480 - mmrotate - INFO - initialize FPN with init_cfg {'type': 'Xavier', 'layer': 'Conv2d', 'distribution': 'uniform'}
2022-11-29 14:47:04,589 - mmrotate - INFO - initialize H2RBoxHead with init_cfg {'type': 'Normal', 'layer': 'Conv2d', 'std': 0.01, 'override': {'type': 'Normal', 'name': 'conv_cls', 'std': 0.01, 'bias_prob': 0.01}}
2022-11-29 14:47:07,436 - mmrotate - INFO - Start running, host: root@container-b8cd11b052-650e1e62, work_dir: /root/autodl-tmp/h2rbox-mmrotate/work_dirs/h2rbox_r50_fpn_6x_ssdd_le90
2022-11-29 14:47:07,436 - mmrotate - INFO - Hooks will be executed in the following order:
before_run:
(VERY_HIGH ) StepLrUpdaterHook
(NORMAL ) CheckpointHook
(LOW ) EvalHook
(VERY_LOW ) TextLoggerHook
(VERY_LOW ) TensorboardLoggerHook
--------------------
before_train_epoch:
(VERY_HIGH ) StepLrUpdaterHook
(LOW ) IterTimerHook
(LOW ) EvalHook
(VERY_LOW ) TextLoggerHook
(VERY_LOW ) TensorboardLoggerHook
--------------------
before_train_iter:
(VERY_HIGH ) StepLrUpdaterHook
(LOW ) IterTimerHook
(LOW ) EvalHook
--------------------
after_train_iter:
(ABOVE_NORMAL) OptimizerHook
(NORMAL ) CheckpointHook
(LOW ) IterTimerHook
(LOW ) EvalHook
(VERY_LOW ) TextLoggerHook
(VERY_LOW ) TensorboardLoggerHook
--------------------
after_train_epoch:
(NORMAL ) CheckpointHook
(LOW ) EvalHook
(VERY_LOW ) TextLoggerHook
(VERY_LOW ) TensorboardLoggerHook
--------------------
before_val_epoch:
(LOW ) IterTimerHook
(VERY_LOW ) TextLoggerHook
(VERY_LOW ) TensorboardLoggerHook
--------------------
before_val_iter:
(LOW ) IterTimerHook
--------------------
after_val_iter:
(LOW ) IterTimerHook
--------------------
after_val_epoch:
(VERY_LOW ) TextLoggerHook
(VERY_LOW ) TensorboardLoggerHook
--------------------
after_run:
(VERY_LOW ) TextLoggerHook
(VERY_LOW ) TensorboardLoggerHook
--------------------
2022-11-29 14:47:07,436 - mmrotate - INFO - workflow: [('train', 1)], max: 72 epochs
2022-11-29 14:47:07,437 - mmrotate - INFO - Checkpoints will be saved to /root/autodl-tmp/h2rbox-mmrotate/work_dirs/h2rbox_r50_fpn_6x_ssdd_le90 by HardDiskBackend.
Traceback (most recent call last):
File "tools/train.py", line 192, in <module>
main()
File "tools/train.py", line 188, in main
meta=meta)
File "/root/autodl-tmp/h2rbox-mmrotate/mmrotate/apis/train.py", line 141, in train_detector
runner.run(data_loaders, cfg.workflow)
File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 127, in run
epoch_runner(data_loaders[i], **kwargs)
File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 47, in train
for i, data_batch in enumerate(self.data_loader):
File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 352, in __iter__
return self._get_iterator()
File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 294, in _get_iterator
return _MultiProcessingDataLoaderIter(self)
File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 827, in __init__
self._reset(loader, first_iter=True)
File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 857, in _reset
self._try_put_index()
File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1091, in _try_put_index
index = self._next_index()
File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 427, in _next_index
return next(self._sampler_iter) # may raise StopIteration
File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/utils/data/sampler.py", line 227, in __iter__
for idx in self.sampler:
File "/root/miniconda3/envs/open-mmlab/lib/python3.7/site-packages/mmdet/datasets/samplers/group_sampler.py", line 36, in __iter__
indices = np.concatenate(indices)
File "<__array_function__ internals>", line 6, in concatenate
ValueError: need at least one array to concatenate
from h2rbox-mmrotate.
Whether this error is caused by dataset.py
class DOTAWSOODDataset(DOTADataset):
def __init__(self,
ann_file,
pipeline,
version='oc',
difficulty=100,
rect_classes=None,
weak_supervised=True,
**kwargs):
self.rect_classes = rect_classes
self.weak_supervised = weak_supervised
super(DOTAWSOODDataset, self).__init__(ann_file, pipeline,
version, difficulty, **kwargs)
def prepare_train_img(self, idx):
img_info = self.data_infos[idx]
ann_info = self.get_ann_info(idx).copy()
if self.weak_supervised:
ann_info['bboxes'] = obb2hbb(
torch.from_numpy(ann_info['bboxes']),
version=self.version).numpy()
results = dict(img_info=img_info, ann_info=ann_info)
if self.proposals is not None:
results['proposals'] = self.proposals[idx]
self.pre_pipeline(results)
return self.pipeline(results)
def obb2hbb_np_le90(self, obboxes):
"""Convert oriented bounding boxes to horizontal bounding boxes.
Args:
obbs (torch.Tensor): [x_ctr,y_ctr,w,h,angle]
Returns:
hbbs (torch.Tensor): [x_ctr,y_ctr,w,h,-pi/2]
"""
# center, w, h, theta = obboxes[..., :2], obboxes[..., 2], obboxes[..., 3], obboxes[..., 4]
center, w, h, theta = np.split(obboxes, [2, 3, 4], axis=-1)
Cos, Sin = np.cos(theta), np.sin(theta)
x_bias = np.abs(w / 2 * Cos) + np.abs(h / 2 * Sin)
y_bias = np.abs(w / 2 * Sin) + np.abs(h / 2 * Cos)
bias = np.concatenate([x_bias, y_bias], axis=-1)
hbboxes = np.concatenate([center - bias, center + bias], axis=-1)
_x = (hbboxes[..., 0] + hbboxes[..., 2]) * 0.5
_y = (hbboxes[..., 1] + hbboxes[..., 3]) * 0.5
_w = hbboxes[..., 2] - hbboxes[..., 0]
_h = hbboxes[..., 3] - hbboxes[..., 1]
_theta = np.zeros(theta.shape[0])
obboxes1 = np.stack([_x, _y, _w, _h, _theta], axis=-1)
obboxes2 = np.stack([_x, _y, _h, _w, _theta - np.pi / 2], axis=-1)
obboxes = np.where((_w >= _h)[..., None], obboxes1, obboxes2)
return obboxes
from h2rbox-mmrotate.
there have x.y.w.h.theta
but The ssdd dataset downloaded from mmrotate has eight parameters caused
from h2rbox-mmrotate.
Please download ssdd from here.
from h2rbox-mmrotate.
For errorValueError: need at least one array to concatenate
, you also need to check the data path.
from h2rbox-mmrotate.
Thank you very much for your answer, this error caused by my carelessness
from h2rbox-mmrotate.
Related Issues (19)
- Some small questions for r2h function. HOT 2
- ImportError HOT 1
- sar图像旋转检测 HOT 16
- .txt format annotation of horizontal boxes for ssdd and hrsid datasets on h2rbox? HOT 14
- RuntimeError encountered when multi-gpu training HOT 6
- Want each category mAP HOT 1
- H2RBoxHead' object has no attribute 'seprate_angle' HOT 1
- Welcome update to OpenMMLab 2.0
- 数据增强 HOT 5
- HRSC dataset test result HOT 2
- visualization of test resuts
- KFIOU的3D实现
- can you share your trained model HOT 1
- Training on HBBs is not giving any performance increase on OBBs test set.
- What is the dotav1 annotation box file used for h2rbox? HOT 5
- 模型训练 HOT 1
- code HOT 1
- About training on HRSID HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h2rbox-mmrotate.