参考网上的博客,出现各种错误,最大的是:
AssertionError: Samples in split doesn't match samples in predictions.
给了解决方案,也不知道那个数字是怎么来的。索性自己来一遍,参考了github issue。
第一步,下载数据集并解压:
wget https://www.nuscenes.org/data/v1.0-mini.tgz # Download the nuScenes mini split.
tar -xf v1.0-mini.tgz -C /data/sets/nuscenes # Uncompress the nuScenes mini split.
第二步,修改代码 tools/create_data.py
elif args.dataset == 'nuscenes' and args.version != 'v1.0-mini':
train_version = f'{args.version}-trainval'
nuscenes_data_prep(
root_path=args.root_path,
info_prefix=args.extra_tag,
version=train_version,
dataset_name='NuScenesDataset',
out_dir=args.out_dir,
max_sweeps=args.max_sweeps)
"""
test_version = f'{args.version}-test'
nuscenes_data_prep(
root_path=args.root_path,
info_prefix=args.extra_tag,
version=test_version,
dataset_name='NuScenesDataset',
out_dir=args.out_dir,
max_sweeps=args.max_sweeps)
"""
第三步,制作数据集
# 进入解压目录
cd /data/sets/nuscenes
# split重命名
mv v1.0-mini v1.0-trainval
python tools/create_data.py nuscenes(固定) --root-path ./data/nuscenes --out-dir ./data/nuscenes --extra-tag nuscenes(固定) --workers 20
第四步,修改配置文件
configs/_base_/datasets/nus-mini-mono3d.py
dataset_type = 'NuScenesDataset'
data_root = 'data/nuscenes/'
configs/fcos3d/fcos3d_r101-caffe-dcn_fpn_head-gn_8xb2-1x_nus-mini-mono3d.py文章来源:https://www.toymoban.com/news/detail-550519.html
_base_ = [
'../_base_/datasets/nus-mini-mono3d.py', '../_base_/models/fcos3d.py',
'../_base_/schedules/mmdet-schedule-1x.py', '../_base_/default_runtime.py'
]
...
#batch_size 根据需要修改
train_dataloader = dict(
batch_size=4, num_workers=4, dataset=dict(pipeline=train_pipeline))
test_dataloader = dict(dataset=dict(pipeline=test_pipeline))
val_dataloader = dict(dataset=dict(pipeline=test_pipeline))
...
# 修改训练epoch
# learning rate
param_scheduler = [
dict(
type='LinearLR',
start_factor=1.0 / 3,
by_epoch=False,
begin=0,
end=200),
dict(
type='MultiStepLR',
begin=0,
end=12,
by_epoch=True,
milestones=[8, 11],
gamma=0.1)
]
第五步,多卡单卡训练文章来源地址https://www.toymoban.com/news/detail-550519.html
# 多卡训练
CUDA_VISIBLE_DEVICES=0,1 tools/dist_train.sh configs/fcos3d/fcos3d_r101-caffe-dcn_fpn_head-gn_8xb2-1x_nus-mini-mono3d.py 2
# 单卡训练
CUDA_VISIBLE_DEVICES=0 tools/dist_train.sh configs/fcos3d/fcos3d_r101-caffe-dcn_fpn_head-gn_8xb2-1x_nus-mini-mono3d.py 1
到了这里,关于mmdetection3d-之(一)--FCOS3d训练nuscenes-mini数据集的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!