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

Cat example does not work out of the box #1007

Open
3 tasks done
daninaga opened this issue May 18, 2024 · 4 comments
Open
3 tasks done

Cat example does not work out of the box #1007

daninaga opened this issue May 18, 2024 · 4 comments

Comments

@daninaga
Copy link

Prerequisite

🐞 Describe the bug

I am able to consistently run the demos through:

from mmdet.apis import DetInferencer

# Initialize the DetInferencer
inferencer = DetInferencer('rtmdet_tiny_8xb32-300e_coco')
print(inferencer)

# Perform inference
inferencer('demo/demo.jpg', show=True)`

However whenever I try running the fine-tuning example for MMYOLO that uses YOLOv5 i always run into:

python tools/train.py configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py

...

miniconda3\envs\mmyolo\lib\site-packages\albumentations\core\composition.py", line 316, in _check_args
    raise ValueError(msg)
ValueError: Key img_path is not in available keys.

is there any need to modify the cat dataset provided or maybe there is some error in the config of yolov5_s-v61_fast_1xb12-40e_cat.py ?

Environment

sys.platform: win32
Python: 3.8.19 (default, Mar 20 2024, 19:55:45) [MSC v.1916 64 bit (AMD64)]
CUDA available: True
MUSA available: False
numpy_random_seed: 2147483648
GPU 0: NVIDIA GeForce RTX 3060
CUDA_HOME: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7
NVCC: Cuda compilation tools, release 11.7, V11.7.64
MSVC: Microsoft (R) C/C++ Optimizing Compiler Version 19.32.31328 for x64
GCC: n/a
PyTorch: 2.0.0
PyTorch compiling details: PyTorch built with:

  • C++ Version: 199711
  • MSVC 193431937
  • Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v2.7.3 (Git Hash 6dbeffbae1f23cbbeae17adb7b5b13f1f37c080e)
  • OpenMP 2019
  • LAPACK is enabled (usually provided by MKL)
  • CPU capability usage: AVX2
  • CUDA Runtime 11.7
  • 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_61,code=sm_61;-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;-gencode;arch=compute_37,code=compute_37
  • CuDNN 8.5
  • Magma 2.5.4
  • Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.7, CUDNN_VERSION=8.5.0, CXX_COMPILER=C:/cb/pytorch_1000000000000/work/tmp_bin/sccache-cl.exe, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj /FS -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_DISABLE_GPU_ASSERTS=OFF, TORCH_VERSION=2.0.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=OFF, USE_NNPACK=OFF, USE_OPENMP=ON, USE_ROCM=OFF,

TorchVision: 0.15.0
OpenCV: 4.9.0
MMEngine: 0.10.4
MMCV: 2.0.1
MMDetection: 3.3.0
MMYOLO: 0.6.0+8c4d9dc

Additional information

No response

@gogoworker
Copy link

I'm having the same issue, do you have any solution to it, please

@daninaga
Copy link
Author

apparently it is an issue with the MMYOLO backend when passing parameters to the albuminations.
workaround is to disable check in albumination core (C:\Users\{USER_NAME}\miniconda3\envs\{ENV_NAME}\Lib\site-packages\albumentations\core\composition.py):

    def _check_args(self, **kwargs: Any) -> None:
        checked_single = ["image", "mask"]
        checked_multi = ["masks"]
        check_bbox_param = ["bboxes"]
        check_keypoints_param = ["keypoints"]
        shapes = []
        for data_name, data in kwargs.items():
            # if data_name=='bboxes':
            #     print(data_name)
            #     print(data)
            if data_name not in self._available_keys and data_name not in ["mask", "masks"] and False:
                msg = f"Key {data_name} is not in available keys."
                # print('keys')
                # print(self._available_keys)
                # print(data)
                # print(kwargs.items())
                raise ValueError(msg)

@gogoworker
Copy link

Helo, I commented directly and simply and crudely on “raise ValueError(msg)”, and then “continue” solved the problem, I hope it helps you

@wdzwdxy
Copy link

wdzwdxy commented May 26, 2024

补充:
禁用代码片段

def _check_args(self, **kwargs: Any) -> None:
        checked_single = ["image", "mask"]
        checked_multi = ["masks"]
        check_bbox_param = ["bboxes"]
        check_keypoints_param = ["keypoints"]
        shapes = []
        for data_name, data in kwargs.items():
            # if data_name not in self._available_keys and data_name not in ["mask", "masks"]:
            #     msg = f"Key {data_name} is not in available keys."
            #     raise ValueError(msg)
            internal_data_name = self._additional_targets.get(data_name, data_name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants