Skip to content

Latest commit

 

History

History
147 lines (105 loc) · 4.64 KB

JuanInstallation.md

File metadata and controls

147 lines (105 loc) · 4.64 KB

Installation instructions

ENVIRONMENT

OS: Ubuntu 20.04 GPU: RTX 3090

Directories structure

Save datasets using the following structure. All BOP datasets should be inside BOP_DATASETS folder.

gdrn_root/
└── datasets/
    ├── BOP_DATASETS/
    │   ├── ambf_suturing
    │   └── tudl
    └── VOCdevkit/
        └── VOC2012

VOCdevkit can be downloaded from this webpage or using the following command:

wget http://pjreddie.com/media/files/VOC2012test.tar

Instructions

Instructions to install python dependencies. Note that the environment has many dependencies and therefore, it might not not be easy to install. Detectron is precompiled against specific versions of pytorch and cuda. If a new version of pytorch is needed detectron also needs to be updated. Based on the prebuilt table shown here we decided to use here torch 1.10 with cuda 11.3

#1. create conda env
# torch==1.10.1+cu113 works detectron v0.6 
conda create -n gdrnpp python=3.9 -y 
conda install pytorch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 cudatoolkit=11.3 -c pytorch -c conda-forge

#2. Install pytorch3d (don't forget its dependencies).
conda install -c fvcore -c iopath -c conda-forge fvcore iopath
conda install pytorch3d -c pytorch3d

#3. Install detectron for torch 1.10.1+cu113
python -m pip install detectron2 -f \
  https://dl.fbaipublicfiles.com/detectron2/wheels/cu113/torch1.10/index.html

#3.5 Test detectron (Optional)
python scripts/detectron_simple_test/detectron_test.py

#4. Run requirements.txt - requirements.txt changed pytorch version on the process.
sh scripts/install_deps.sh no

Notes:

  • step 4 broke opencv installation. You can fix it with pip uninstall opencv-python followed by pip install opencv-python.

Additional dependencies

  1. Compile bop_renderer.

  2. Modify config.py in pysixd folder.

    • Change BOP_RENDERER_PATH to the path of the compiled bop_renderer.
    • Change BOP_PATH to the path of the BOP dataset.
  3. Soft link bob_renderer to root

ln -s /home/jbarrag3/research_juan/gdr-net-6dpose/gdrnpp_bop2022/bop_renderer ./bop_renderer
  1. Compile egl_renderer
cd ./lib/egl_renderer
sh compile_cpp_egl_renderer.sh

Compiling BOP_renderer

Download repo: https://github.com/thodan/bop_renderer

Make sure to activate the correct python environment before compiling the BOP_renderer

sudo apt install libosmesa6-dev
sudo apt-get install python-dev
git clone git@github.com:thodan/bop_renderer.git
conda activate <ENV_NAME>
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$(which python)
cmake --build build

Ensure you have the compiled library by executing

ls bop_renderer/*.so

which should print

bop_renderer/bop_renderer.cpython-39-x86_64-linux-gnu.so

Testing installation with GDRN simple scripts

The following scripts should run after setting up the dataset and the anaconda environment. All commands below assume you are located in the root folder of the gdrnpp repo. Make sure to install gdrnsimple with

pip install -e ./scripts

Testing scripts

Testing detectron

python3 scripts/detectron_simple_test/detectron_test.py

test data loader

python3 scripts/juan_test_scripts/load_dataset.py

test data loader and renderer

python3 scripts/juan_test_scripts/render_gt.py

Original training and testing scripts for gdrn and yolox

  1. For training, generated fps points for each dataset. See for example tudl_1_comput_fps.py

  2. Download pretrained models and use grdn and yolox test scripts.

Yolox test

./det/yolox/tools/test_yolox.sh  ./configs/yolox/bop_pbr/yolox_x_640_augCozyAAEhsv_ranger_30_epochs_tudl_real_pbr_tudl_bop_test.py 0 ./output/pretrained/yolox_x_640_augCozyAAEhsv_ranger_30_epochs_tudl_real_pbr_tudl_bop_test/model_final.pth

gdrn test

./core/gdrn_modeling/test_gdrn.sh configs/gdrn/tudl/convnext_a6_AugCosyAAEGray_BG05_mlL1_DMask_amodalClipBox_classAware_tudl.py 0 ./output/pretrained/tudl/convnext_a6_AugCosyAAEGray_BG05_mlL1_DMask_amodalClipBox_classAware_tudl/model_final_wo_optim.pth

Troubleshooting:

  • Your dataloader is trying to load unexisting data.

Make sure to erase the .cache folder inside on your root directory. Dataset paths are cached meaning that changes in the dataset folder won't be reflected in the dataloader.