TypeError: CocoDataset: __init__() got an unexpected keyword argument 'times'
See original GitHub issueHi! Thanks for solid work. 👍
I have the following bug:
Description
I am receiving TypeError: CocoDataset: __init__() got an unexpected keyword argument 'times'
while training from scratch CocoDataset like custom dataset. The same bug occurs when I also run SSD, DETR, YoloV3. But there is no issue with models, such as VFNet, Cascade, RetinaNet. So I cannot see clear reason for now.
Look forward to your help, Thank you! 🙏
Reproduction
I am running:
python centernet.py
where my centernet.py
file is defined as below:
import torch
from mmcv import Config
from mmdet.apis import set_random_seed, train_detector
from mmdet.datasets import build_dataset
from mmdet.models import build_detector
from IPython.display import clear_output
cfg = Config.fromfile('./mmdetection/configs/centernet/centernet_resnet18_dcnv2_140e_coco.py')
DATASET_TYPE = 'CocoDataset'
PREFIX = '$path-to-my-images'
cfg.dataset_type = DATASET_TYPE
cfg.classes = ("CIN-1", "CIN-2", "CIN-3")
cfg.model.bbox_head.num_classes = 3
cfg.data.train.img_prefix = PREFIX
cfg.data.train.classes = cfg.classes
cfg.data.train.ann_file = '$path-to-train.json'
cfg.data.train.type = DATASET_TYPE
cfg.data.val.img_prefix = PREFIX
cfg.data.val.classes = cfg.classes
cfg.data.val.ann_file = '$path-to-val.json'
cfg.data.val.type = DATASET_TYPE
cfg.data.test.img_prefix = PREFIX
cfg.data.test.classes = cfg.classes
cfg.data.test.ann_file = '$path-to-test.json'
cfg.data.test.type = DATASET_TYPE
cfg.optimizer.lr = 0.01 / 8
cfg.optimizer_config.grad_clip = dict(max_norm=35, norm_type=2)
cfg.lr_config.policy = 'step'
cfg.lr_config.step = 7
#cfg.lr_config.warmup = None
#cfg.log_config.interval = 100
# Change the evaluation metric since we use customized dataset.
cfg.evaluation.metric = 'bbox'
# We can set the evaluation interval to reduce the evaluation
cfg.evaluation.interval = 4
# We can set the checkpoint saving interval to reduce the storage cost
cfg.checkpoint_config.interval = 4
# Set seed thus the results are more reproducible
cfg.seed = 0
set_random_seed(0, deterministic=False)
cfg.gpu_ids = range(1)
# we can use here mask_rcnn.
cfg.load_from = ''$path-to-pretrained-model.pth"
cfg.work_dir = ''$path-to-working-dir"
cfg.runner.max_epochs = 30
cfg.total_epochs = 30
clear_output()
model = build_detector(cfg.model)
datasets = [build_dataset(cfg.data.train)]
train_detector(model, datasets[0], cfg, distributed=False, validate=True)
Environment
- Please run
python mmdet/utils/collect_env.py
to collect necessary environment information and paste it here.
sys.platform: linux
Python: 3.7.10 | packaged by conda-forge | (default, Feb 19 2021, 16:07:37) [GCC 9.3.0]
CUDA available: True
GPU 0,1,2,3,4,5: GeForce RTX 3090
CUDA_HOME: /usr/local/cuda-11.2
NVCC: Build cuda_11.2.r11.2/compiler.29558016_0
GCC: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
PyTorch: 1.9.0+cu111
PyTorch compiling details: PyTorch built with:
- GCC 7.3
- C++ Version: 201402
- Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications
- Intel(R) MKL-DNN v2.1.2 (Git Hash 98be7e8afa711dc9b66c8ff3504129cb82013cdb)
- OpenMP 201511 (a.k.a. OpenMP 4.5)
- NNPACK is enabled
- CPU capability usage: AVX2
- CUDA Runtime 11.1
- NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86
- CuDNN 8.0.5
- Magma 2.5.2
- Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.1, CUDNN_VERSION=8.0.5, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.9.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON,
TorchVision: 0.10.0+cu111
OpenCV: 4.5.3
MMCV: 1.3.12
MMCV Compiler: GCC 7.3
MMCV CUDA Compiler: 11.1
MMDetection: 2.15.1+3545915
- I installed
mmdet
with as follows:
- A.
conda create -n openmmlab python=3.7 -y
conda activate
- B.
pip install openmim
mim install mmdet
Issue Analytics
- State:
- Created 2 years ago
- Comments:7
Top Results From Across the Web
TypeError: __init__() got an unexpected keyword argument ...
My assumption is the error is due to the incompatibility of file tf_example_decoder.py with the Tensorflow installed. Try removing that argument ...
Read more >init__() got an unexpected keyword argument 'max_iter'?
TypeError : init() got an unexpected keyword argument 'max_iter'. I m running the linear regression code in Community edition. Google says reinstall --....
Read more >Release 2.18.0 MMDetection Authors - Read the Docs
We provide analyze_logs.py to get average time of iteration in training. You can find examples in Log Analysis.
Read more >Mmdetection custom dataset training bug - PyTorch Forums
... mask_head=dict(num_classes=1))) # Modify dataset related settings dataset_type = 'COCODataset' classes = ('foliole_0',) data = dict( ...
Read more >How to create custom COCO data set for instance segmentation
Run my script to convert the labelme annotation files to COCO dataset JSON file. ... TypeError: __init__() got an unexpected keyword argument ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
hi,i met the same error and i would like to know to commenting which part of the code can make the code work.
@tuttelikz You have to check if you use RepeatDataset?Please refer to CenterNet cfg: