Try   HackMD

Hồ Chí Minh, 03-08-2023
Nguyễn Xuân Quang, Lê Toàn, Võ Duy Nguyên, UIT-Together Research Group

Mục Lục

Step 1. Cài đặt môi trường

Step 1.1. Tạo môi trường anaconda

Đặt tên theo cú pháp: Ten_viet tat cua ho va chu lot

VD: Nguyen Xuan Quang -> Quangnx

conda create --name UITTogether python=3.8 -y

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Step 1.2. Kích hoạt môi trường vừa tạo

conda activate UITTogether

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Step 1.3. Cài đặt PyTorch trên GPU platforms

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Step 2. Cài đặt MMEngine và MMCV sử dụng MIM

pip install -U openmim mim install mmengine mim install "mmcv>=2.0.0,<2.1.0"

Hình ảnh cài đặt thành công openmim

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Hình ảnh cài đặt thành công MMEngine

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Hình ảnh cài đặt thành công MMCV

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Step 3. Thao tác với MMDetection

Truy cập vào thư mục luutru
VD: /home/u2301/luutru/

cd luutru/

Tạo thư mục tương ứng với tên môi trường bên trên

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

cd UITTogether/

Step 3.1. Cài đặt MMDetection

Tại thư mục này thực hiện clone và cài đặt mmdetection

git clone https://github.com/open-mmlab/mmdetection.git cd mmdetection pip install -v -e .

Hình ảnh clone thành công

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Step 3.2. Tải file config va checkpoints

mim download mmdet --config rtmdet_tiny_8xb32-300e_coco --dest .

Hình ảnh tải thành công file config va checkpoints

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Verify the installation

Verify the inference demo

python demo/image_demo.py demo/demo.jpg rtmdet_tiny_8xb32-300e_coco.py --weights rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth --device cpu

Kết quả được lưu trong thư mục outputs/vis
Vd: /home/u2301/luutru/UITTogether/mmdetection/outputs/vis/

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Tạo thư mục checkpoints

mkdir ./checkpoints

Tải checkpoints của file config rtmdet_tiny_8xb32-300e_coco

mim download mmdet --config rtmdet_l_8xb32-300e_coco --dest ./checkpoints

Hình ảnh tải thành công

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Tạo thư mục data trong thư mục mmdetection để chứa shortcut dẫn tới thư mục MS-COCO

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Sử dụng chung thư mục MS-COCO nên chúng ta sẽ tạo 1 shortcut dẫn tới thư mục MS-COCO dùng chung bằng lệnh:
ln -s /duong dan toi thu muc goc /duong dan toi thu muc luu shortcut

ln -s /home/u2301/luutru/coco/ /home/u2301/luutru/UITTogether/mmdetection/data/

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Test với dữ liệu MS-COCO

python tools/test.py \ configs/rtmdet/rtmdet_l_8xb32-300e_coco.py \ checkpoints/rtmdet_l_8xb32-300e_coco_20220719_112030-5a0be7c4.pth \ --show
python tools/test.py \ configs/rtmdet/rtmdet_l_8xb32-300e_coco.py \ checkpoints/rtmdet_l_8xb32-300e_coco_20220719_112030-5a0be7c4.pth \ --show-dir faster_rcnn_r50_fpn_1x_results

Tài liệu hướng dẫn dùng cho nhóm UIT-Together Research Group