lhoyer / HRDA

[ECCV22] Official Implementation of HRDA: Context-Aware High-Resolution Domain-Adaptive Semantic Segmentation
Other
231 stars 32 forks source link

assertion lenth error about samples_with_class during trainning #41

Closed tonyRyo closed 5 months ago

tonyRyo commented 5 months ago

Hello, I followed the README instructions trying to use gta data for training.

I can make predictions for cityscapes images with the pre-trained model gtaHR2csHR_hrda_246ef.

But when I tried to train the model with the code below( not using full gta dataset, only 4999 pics of them), python run_experiments.py --config configs/hrda/gtaHR2csHR_hrda.py I got some assertion lenth error about samples_with_class.

2024-01-11 11:21:01,827 - mmseg - INFO - Loaded 4999 images from data/gta/images
2024-01-11 11:21:01,910 - mmseg - INFO - Loaded 2975 images from data/cityscapes/leftImg8bit/train
2024-01-11 11:21:01,911 - mmseg - INFO - RCS Classes: [17, 7, 6, 4, 9, 5, 13, 14, 3, 11, 8, 1, 10, 2, 0]
2024-01-11 11:21:01,911 - mmseg - INFO - RCS ClassProb: [1.6132097e-01 1.5626104e-01 1.5324336e-01 1.3592052e-01 1.0360345e-01
 6.5830752e-02 5.8957204e-02 5.6184866e-02 4.4540595e-02 4.0169138e-02
 2.2608098e-02 1.3449171e-03 1.5118295e-05 1.4972226e-13 3.3338909e-23]
Traceback (most recent call last):
  File "run_experiments.py", line 120, in <module>
    train.main([config_files[i]])
  File "d:\HRDA\tools\train.py", line 151, in main
    datasets = [build_dataset(cfg.data.train)]
  File "d:\HRDA\mmseg\datasets\builder.py", line 73, in build_dataset
    dataset = UDADataset(
  File "d:\HRDA\mmseg\datasets\uda_dataset.py", line 100, in __init__
    assert len(self.samples_with_class[c]) > 0
AssertionError

I wonder if you could give me some advice. The environment info is as below. Many thanks.

2024-01-11 11:20:59,637 - mmseg - INFO - Environment info:
------------------------------------------------------------
sys.platform: win32
Python: 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)]
CUDA available: True
GPU 0: NVIDIA GeForce RTX 4070 Laptop GPU
CUDA_HOME: [C:\Program](file:///C:/Program) Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
NVCC: Not Available
GCC: n/a
PyTorch: 1.7.1+cu110
PyTorch compiling details: PyTorch built with:
  - C++ Version: 199711
  - MSVC 192729112
  - Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191125 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v1.6.0 (Git Hash 5ef631a030a6f73131c77892041042805a06064f)
  - OpenMP 2019
  - CPU capability usage: AVX2
  - CUDA Runtime 11.0
  - 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_37,code=compute_37
  - CuDNN 8.0.4
  - Magma 2.5.4
  - Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -openmp:experimental -DNDEBUG -DUSE_FBGEMM -DUSE_VULKAN_WRAPPER, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=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, 

TorchVision: 0.8.2+cu110
OpenCV: 4.4.0
MMCV: 1.3.7
MMCV Compiler: n/a
MMCV CUDA Compiler: n/a
MMSegmentation: 0.16.0+504516b
tonyRyo commented 5 months ago

fixed now