Comments (4)
Currently it is not possible to train on multiple datasets by only modifying the config file, and I think your solution is simple and feasible.
If you find it working, welcome to submit a PR. Thanks!
from mmdetection.
I am using torch.utils.data.dataset.ConcatDataset
to concat a dataset with multiple ann_files.
def get_train_dataset(cfg):
if isinstance(cfg.data.train['ann_file'], list) or isinstance(cfg.data.train['ann_file'], tuple):
ann_files = cfg.data.train['ann_file']
train_datasets = []
for ann_file in ann_files:
data_info = copy.deepcopy(cfg.data.train)
data_info['ann_file'] = ann_file
train_dset = obj_from_dict(data_info, datasets)
train_datasets.append(train_dset)
if len(train_datasets) > 1:
train_dataset = ConcatDataset(train_datasets)
else:
train_dataset = train_datasets[0]
else:
train_dataset = obj_from_dict(cfg.data.train, datasets)
return train_dataset
I got this error when I run the training script:
Traceback (most recent call last):
File "tools/train.py", line 104, in <module>
main()
File "tools/train.py", line 100, in main
logger=logger)
File "/data/wanggu/mmdetection/mmdet/apis/train.py", line 59, in train_detector
_non_dist_train(model, dataset, cfg, validate=validate)
File "/data/wanggu/mmdetection/mmdet/apis/train.py", line 103, in _non_dist_train
dist=False)
File "/data/wanggu/mmdetection/mmdet/datasets/loader/build_loader.py", line 31, in build_dataloader
sampler = GroupSampler(dataset, imgs_per_gpu)
File "/data/wanggu/mmdetection/mmdet/datasets/loader/sampler.py", line 14, in __init__
assert hasattr(dataset, 'flag')
AssertionError
@hellock Do you have any idea about this?
from mmdetection.
We use a field flag
to identify different groups for the GroupSampler, but the ConcatDataset
only implements __len__
and __getitem__
. You may need to inherit the official ConcatDataset
and add the flag
filed, which simply concatenates flags of all datasets.
from mmdetection.
@hellock Yeah. I've noticed that. Now it works.
from mmdetection.
Related Issues (20)
- Run models without installing mmdetection, openmim or mm related packages (CO-DETR)
- Additional metrics to tensorboard HOT 1
- When the code reproduces: No module named 'mmdet.models.utils.res_layer' HOT 1
- The problem with fine-tuning MM-Grounding DINO.
- What's the difference between Grounding-dino's pretrain and finetune?
- Issues replicating mmdetection v2 results with mmdetection v3
- Unable to deploy glip model in mmdetection due to not downloading bert, transformer, etc. correctly HOT 1
- training stuck problem HOT 1
- When I run the "python mmskl. py pose demo" command, I receive an error message "urllib. error. HTTPError: HTTP Error 403: Forbidden"
- mm-Groundingdino加载预训练权重失败
- How should I implement multi-GPU inference for DINO in image_demo.py?
- Need help pls "AttributeError: module 'mmcv' has no attribute 'jit'"
- How to solve version incompatibility problem? HOT 1
- Forced resizing of images before use of RandomCrop negating point of cropping?
- Is the docstring incorrect in models.dense_heads.anchor_free_head.py ?
- KeyError: 'model'
- AssertionError: MMCV==2.1.0 is used but incompatible. Please install mmcv>=1.3.17, <=1.8.0. HOT 1
- Hello, could you please provide the training approach for fine-tuning the referring expression comprehension (REC) task?
- How to hide certain category while inferencing
- AssertionError: !! not found config file: xxx after pyinstaller a .exe file HOT 1
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 mmdetection.