dbash / zerowaste

[CVPR 2022] ZeroWaste Dataset: Towards Deformable Object Segmentation in Cluttered Scenes
MIT License
42 stars 9 forks source link

ymal file and weights available for pre-trained ZeroWaste model? #10

Closed saurmart closed 1 year ago

saurmart commented 1 year ago

Hi, thanks again for your work! Do you also have a config yaml file and corresponding weights for a model pre-trained on the fully annotated ZeroWaste-f dataset or the ZeroWasteAug dataset? I would like to test how well this model performs on my custom dataset.

dbash commented 1 year ago

Hi Martin,

The checkpoints for the models used in the paper are stored at http://csr.bu.edu/ftp/recycle/models/ Please let me know if there are any issues.

Dina

saurmart commented 1 year ago

Hi @dbash,

I wanted to evaluate semantic segmentation with deeplab using your provided code and dataset. Later I wanted to do inference with your trained model on my custom dataset. First, I took your code for evaluation with deeplab

Evaluate the pre-trained deeplab ZeroWaste:

python deeplab/train_net.py --config-file deeplab/configs/zerowaste_config.yaml --dataroot /path/to/zerowaste-or-taco/data/  --eval-only OUTPUT_DIR /deeplab/outputs/results/ --MODEL.WEIGHTS path/to/checkpoint.pth

As I use colab, I have uploaded all the relevant files to my drive and adapted the code as follows:

Evaluate the pretrained deeplab ZeroWaste in colab:

!python '/content/drive/MyDrive/Evaluation_ZeroWaste/train_net.py' --config-file '/content/drive/MyDrive/Evaluation_ZeroWaste/zerowaste_config.yaml' --dataroot '/content/drive/MyDrive/Evaluation_ZeroWaste/' --eval-only OUTPUT_DIR '/content/drive/MyDrive/Evaluation_ZeroWaste/outputs/results/' --MODEL.WEIGHTS '/content/drive/MyDrive/Evaluation_ZeroWaste/model_final.pth'

For the above code I used the following files:

train_net.py: https://github.com/dbash/zerowaste/blob/main/deeplab/train_net.py config.yaml: https://github.com/dbash/zerowaste/blob/main/deeplab/configs/zerowaste_config.yaml dataset + labels: http://csr.bu.edu/ftp/recycle/models/zerowaste-f weights: http://csr.bu.edu/ftp/recycle/models/deeplab/model_final.pth

I got the following error and don't know how to solve it. Maybe you can help me with this problem.

Command Line Args: Namespace(config_file='/content/drive/MyDrive/Evaluation_ZeroWaste/zerowaste_config.yaml', resume=False, eval_only=True, num_gpus=1, num_machines=1, machine_rank=0, dist_url='tcp://127.0.0.1:49152', opts=['OUTPUT_DIR', '/content/drive/MyDrive/Evaluation_ZeroWaste/outputs/results/', '--MODEL.WEIGHTS', '/content/drive/MyDrive/Evaluation_ZeroWaste/model_final.pth'], dataroot='/content/drive/MyDrive/Evaluation_ZeroWaste/')
Registering the zero-waste dataset splits
Traceback (most recent call last):
  File "/content/drive/MyDrive/Evaluation_ZeroWaste/train_net.py", line 271, in <module>
    launch(
  File "/usr/local/lib/python3.10/dist-packages/detectron2/engine/launch.py", line 84, in launch
    main_func(*args)
  File "/content/drive/MyDrive/Evaluation_ZeroWaste/train_net.py", line 248, in main
    cfg = setup(args)
  File "/content/drive/MyDrive/Evaluation_ZeroWaste/train_net.py", line 196, in setup
    cfg.merge_from_list(args.opts)
  File "/usr/local/lib/python3.10/dist-packages/fvcore/common/config.py", line 143, in merge_from_list
    return super().merge_from_list(cfg_list)
  File "/usr/local/lib/python3.10/dist-packages/yacs/config.py", line 238, in merge_from_list
    _assert_with_logging(
  File "/usr/local/lib/python3.10/dist-packages/yacs/config.py", line 545, in _assert_with_logging
    assert cond, msg
AssertionError: Non-existent key: --MODEL.WEIGHTS

So my question is, is there anything I need to change in deeplab/train_net.py or deeplab/zerowaste_config.yaml to get the code to run? So far I only changed the dataroot in deeplab/train_net.py to my google drive directory.

The environment info of colab is attached:

[09/22 13:02:29 detectron2]: Environment info:
-------------------------------  -----------------------------------------------------------------
sys.platform                     linux
Python                           3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
numpy                            1.23.5
detectron2                       0.6 @/usr/local/lib/python3.10/dist-packages/detectron2
Compiler                         GCC 11.4
CUDA compiler                    CUDA 11.8
detectron2 arch flags            7.5
DETECTRON2_ENV_MODULE            <not set>
PyTorch                          2.0.1+cu118 @/usr/local/lib/python3.10/dist-packages/torch
PyTorch debug build              False
torch._C._GLIBCXX_USE_CXX11_ABI  False
GPU available                    Yes
GPU 0                            Tesla T4 (arch=7.5)
Driver version                   525.105.17
CUDA_HOME                        /usr/local/cuda
Pillow                           9.4.0
torchvision                      0.15.2+cu118 @/usr/local/lib/python3.10/dist-packages/torchvision
torchvision arch flags           3.5, 5.0, 6.0, 7.0, 7.5, 8.0, 8.6
fvcore                           0.1.5.post20221221
iopath                           0.1.9
cv2                              4.8.0
-------------------------------  -----------------------------------------------------------------
PyTorch built with:
  - GCC 9.3
  - C++ Version: 201703
  - Intel(R) oneAPI Math Kernel Library Version 2022.2-Product Build 20220804 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v2.7.3 (Git Hash 6dbeffbae1f23cbbeae17adb7b5b13f1f37c080e)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - LAPACK is enabled (usually provided by MKL)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 11.8
  - 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;-gencode;arch=compute_90,code=sm_90
  - CuDNN 8.7
  - Magma 2.6.1
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.8, CUDNN_VERSION=8.7.0, CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 -fabi-version=11 -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wunused-local-typedefs -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -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 -Werror=cast-function-type -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_DISABLE_GPU_ASSERTS=ON, TORCH_VERSION=2.0.1, 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=1, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, 
saurmart commented 1 year ago

I have found the problem. You need to use MODEL.WEIGHTS instead of --MODEL.WEIGHTS. Perhaps you could correct this in your README.