티스토리 뷰
+) CUDA9.0을 이용하라고 되어있어서 cuda:9.0 image를 새로 만들어서 docker container에서 작업하였다.
사용한 docker image: docker pull nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
참고) Docker hub
https://hub.docker.com/r/nvidia/cuda/tags?page=1
Docker Hub
hub.docker.com
1. git clone
git clone https://github.com/SuperMHP/GUPNet.git
https://github.com/SuperMHP/GUPNet
GitHub - SuperMHP/GUPNet
Contribute to SuperMHP/GUPNet development by creating an account on GitHub.
github.com
2. 필요한 package 설치
cd GUPNet/code
python3 -m pip install -r requirements.yml
requirements.yml에 torch, torchvision, 그리고 cudatoolkit, python3.6까지 전부 명시되어 있다.나는 이미 내 docker container에 깔려있던 것들이 많았지만 귀찮으니 그냥 requirements.yml 이용해서 나머지 package도 설치하기로 한다.
Error1) ERROR: Invalid requirement: 'name: gupnet' (from line 1 of requirements.yml)
Solution) ㅇㅅㅇ.. pip install -r 에 names:, channels:, dependencies:가 있는 yml file을 준 걸 본적이 없는데 이렇게 되어있어서 당황쓰.. 아무래도 conda의 environment.yml을 표현하려고 했던 것 같다.그냥 requirment.yml안에 있는 dependencies 대로 pip로 하나씩 다 설치해주었다.
python3 -m pip install torch==1.1 torchvision==0.3.0
python3 -m pip install tqdm matplotlib scikit-image pyyaml
python3 -m pip install opencv-python
별 의미는 없는데, 그냥 한 줄에 들어가면 보기 안좋으니까 세 줄에 나눠서 install할 package들을 적어보았다.
실제 내가 설치할 때는 걍 python3 -m pip install 하고 쭈우우욱 package name 써서 설치함.
3. Training
CUDA_VISIBLE_DEVICES=2 python3 tools/train_val.py
Error1) ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
Solution) libglib2.0-0 설치
apt-get install libglib2.0-0
root가 아니라면, apt-get을 쓸 때는 sudo를 붙여 실행시켜야한다.
나는 docker container라 default가 root라 걍 sudo 없이 실행 가능했다.
Error2) torchvision/_C.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe26detail36_xxxxxxxx
Solution) 최선의 solution인지 모르겠지만 torchvision을 0.4로 upgrade하면 된다고 하는 글이 많아서 0.3에서 0.4로 바꿔줬더니 된다. 흠... document에서 0.3쓰라고 했는데 왜 0.3에서는 안되는걸까?
https://github.com/facebookresearch/maskrcnn-benchmark/issues/891
_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN3c106Device8validateEv · Issue #891 · facebookresearch/maskrcnn-bench
❓ Questions and Help ImportError: /home/ltc/anaconda3/envs/maskrcnn_benchmark_/lib/python3.6/site-packages/torchvision/_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN3c106Device8validateE...
github.com
Error3) FileNotFoundError: [Errno 2] No such file or directory: '../../Dataset/3d-detection/KITTI/ImageSets/train.txt'
Solution) Kitti dataset linking
vim GUPNet/code/experiometns/config.yaml
config.yaml 에 들어가서 kitti data가 있는 경로로 root를 바꿔준다.
나는 GUPNet/code 안에 Dataset folder를 따로 만들어서 나의 원래 Kitti dataset folder를 linking 해주는 방법을 선택했다.
# 기존 코드
root_dir: '../../Dataset/3d-detection/'
# 내가 원하는 경로로 root_dir 변경
root_dir: './Dataset/'
ln -s /workspace/Kitti/object/training Dataset/KITTI/
ln -s /workspace/Kitti/object/testing Dataset/KITTI/
이런 불친절한 document... Kitti dataset linking해야하는 건 당연한 일이지만 내가 이 error 만나기 전에 미리 하라고 하면 좋잖아!!!! 그치만... 해결 가능한 에러라 기분이 좋은 건 왜일까.ㅎ
아, 근데 필요한 dataset 경로 설정하는거 좀 짜증나게 되어있네... ㅇㅅㅇ 그냥 하나씩 연결하고 다시 실행하고 하면서
없다고 떽떽거리는 친구들이 뱉는 에러 보고 directory 연결해주기 or file 옮겨주기...
Error4) RuntimeError: CUDA out of memory. Tried to allocate 480.00 MiB
Solution) Multigpu를 이용한 training을 지원하면 좋으련만 따로 multigpu 환경은 구현을 해놓지 않은 것 같다(사실 안찾아봄. 그냥 document에 없어서 그렇게 생각함..) 그래서 그냥 batch size를 줄여주기로 한다.
# code/experiments/config.yaml
# 기존 batch size는 32
batch_size: 32
# batch_size 몇까지 감당할 수 있을지 모르겠지만 안전하게 그냥 4로 내림
batch_size: 4
참고로 내가 사용하고 있는 GPU는 RTX2080-Ti로 11GB의 memory를 가지고 있다.
nvidia-smi로 GPU memory 사용량을 보니 5000MiB 정도 되는 걸로 보아 batch_size를 8로 설정해도 무난히 training 가능할 것으로 보인다.
4. Evaluation
# experiments/config.yaml
tester:
resume_model: './log/checkpoints/checkpoint_epoch_140.pth'
# resume_model 주석 풀어주고 pth있는 path 입력
CUDA_VISIBLE_DEVICES=2 python3 tools/train_val.py -e
이렇게 하면 outputs/data에 각 frame에서 찾아낸 object와 bbox 정보가 기록된다.
그러나 내가 하고 싶은 것은..! AP 구하기..!
특히 나는 AP|R40을 구하고 싶으므로 ap40.cpp를 이용하기로 한다.
g++ evaluate_object_3d_offline_ap40.cpp -o evaluate_object_3d_offline_ap
Error1) evaluate_object_3d_offline_ap40.cpp:12:42: fatal error: boost/numeric/ublas/matrix.hpp: No such file or directory
Solution) apt-get install libboost-all-dev
만들어진 evaluate_object_3d-offline_ap를 수행
./evaluate_object_3d_offline_ap ../../Dataset/KITTI/training/labels_2 ../../outputs
아 근데 결과가 너무 별론데... GUPNet github에 있는 pretrained weight 받아다가 해도 똑같네..ㅇㅅㅇ
'이것저것 자료 > 그 외' 카테고리의 다른 글
[LGSVL] Lincoln2017mkz camera 및 Lidar FPS 바꾸기 (0) | 2021.10.26 |
---|---|
[Open-source build] MonoDLE build 하기 (0) | 2021.10.13 |
[Open-source build] MonoFlex build 하기 (0) | 2021.10.12 |
[Open-source build] SMOKE build 하기 (0) | 2021.10.12 |
[Open-source build] M3DSSD build 하기 (0) | 2021.09.24 |
- Total
- Today
- Yesterday
- dfs
- n과m
- 백준
- 이것이코딩테스트다
- 파이썬
- 백트래킹
- torch
- error
- version
- PIP
- shellscript
- tensorflow
- notfound
- 동적프로그래밍
- Python
- 카카오
- numpy
- 프로그래머스
- pytorch
- BFS
- 설치
- torchscript
- 최소신장트리
- 코딩테스트
- LGSVL
- matplotlib
- 다익스트라
- docker
- 설치하기
- CUDA
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |