본문 바로가기
Two/영상처리

mmpretrain 사용법 (4)

by DH Father 2023. 12. 31.

mmpretrain 사용법 (4)

mmpretrain study

 



mmpretrain 사용법 (4)

config 파일, dataset 준비, inference에 대해 스터디했다.

 

이번에는 데이터에 대해 train과 test 하는 방법에 대해 알아본다. 

 

Train

mmpretrain에서 학습하는 방법은 명령어를 통해 간단하게 할 수 있다. 

보다 자세한 예시는 문서와 아래 reference를 참조하자. 

 

Train with your PC

아래와 같이 tools/train.py 를 실행하면 train을 할 수 있다. 

python tools/train.py ${CONFIG_FILE} [ARGS]

 

[ARGS] 를 통해 다양한 옵션을 지정해서 학습이 가능한데,  자세한 것은 아래 그림으로 추가했다. 

 

Train with multiple GPUs

torch.distributed.launch 와 함께 multi-GPUs task를 제공한다.

아래의 명령어를 통해 사용 가능한다. 

bash ./tools/dist_train.sh ${CONFIG_FILE} ${GPU_NUM} [PY_ARGS]

 

CONFIG_FILE, GPU_NUM, PY_ARGS 에 대한 설명은 아래 그림과 같다. 

이외에도 port 를 지정해주거나, device를 지정해주는 부분이 있는데, 그건 문서를 참조하자. 

 

아래 내용에 대해서는 필요하다면 문서를 참조하자. 

Train with multiple machines

 - multiple machines in the same network

 - multiple machines managed with slurm

 

 

Test

Test with your PC

tools/test.py 파일을 사용하여 test를 진행할 수 있다.

아래는 사용하는 명령어와 옵션에 대한 설며이다. 

python tools/test.py ${CONFIG_FILE} ${CHECKPOINT_FILE} [ARGS]

 

Test with multiple GPUs

Train과 동일하게 multiple GPU를 지원하며, 사용 명령어와 옵션은 아래와 같다.

역시 Train과 동일하게 port, device 등을 지정해 줄 수 있다. 

bash ./tools/dist_test.sh ${CONFIG_FILE} ${CHECKPOINT_FILE} ${GPU_NUM} [PY_ARGS]

 

아래 항목에 대한 내용은 문서를 참조하자.

Test with multiple machines

 - Multiple machines in the same network

 - Multiple machine managed with slurm

 

 

Reference

https://mmpretrain.readthedocs.io/en/latest/user_guides/train.html

 

Train — MMPretrain 1.1.1 documentation

Train In this tutorial, we will introduce how to use the scripts provided in MMPretrain to start a training task. If you need, we also have some practice examples about how to pretrain with custom dataset and how to finetune with custom dataset. Train with

mmpretrain.readthedocs.io

https://mmpretrain.readthedocs.io/en/latest/notes/pretrain_custom_dataset.html

 

How to Pretrain with Custom Dataset — MMPretrain 1.1.1 documentation

How to Pretrain with Custom Dataset In this tutorial, we provide a practice example and some tips on how to train on your own dataset. In MMPretrain, We support the CustomDataset (similar to the ImageFolder in torchvision), which is able to read the images

mmpretrain.readthedocs.io

https://mmpretrain.readthedocs.io/en/latest/notes/finetune_custom_dataset.html

 

How to Fine-tune with Custom Dataset — MMPretrain 1.1.1 documentation

How to Fine-tune with Custom Dataset In most scenarios, we want to apply a pre-trained model without training from scratch, which might possibly introduce extra uncertainties about the model convergency and therefore, is time-consuming. The common sense is

mmpretrain.readthedocs.io

 

'Two > 영상처리' 카테고리의 다른 글

mmdetection 개요 및 설치  (0) 2024.01.08
mmpretrain 적용 - CIFAR10  (1) 2024.01.08
mmpretrain 사용법 (3)  (1) 2023.12.30
mmpretrain 사용법 (2)  (0) 2023.12.29
mmpretrain 사용법 (1)  (0) 2023.12.28