본문 바로가기
computer vision/dna_study

pytorch 데이터셋 augmentation(transformer 적용)

by dohunNewte 2023. 3. 17.
반응형

 

 

이전의 데이터셋 포스팅을 보시면 더 이해가 잘될거같습니다.

https://dohun-0714.tistory.com/27

 

pytorch 데이터셋 클래스

https://github.com/dohun-mat/dna_study_semina/blob/main/%EA%B3%BC%EC%A0%9C/week4_%EA%B3%BC%EC%A0%9C_2.ipynb GitHub - dohun-mat/dna_study_semina Contribute to dohun-mat/dna_study_semina development by creating an account on GitHub. github.com 코드는 깃

dohun-0714.tistory.com

 

자세한코드는 깃허브를 참고하면됩니다.

https://github.com/dohun-mat/dna_study_semina/blob/main/%EA%B3%BC%EC%A0%9C/week4_%EA%B3%BC%EC%A0%9C_2.ipynb

 

GitHub - dohun-mat/dna_study_semina

Contribute to dohun-mat/dna_study_semina development by creating an account on GitHub.

github.com

 

 

Normalize: 픽셀 값에 대해 (X - mean)/std를 진행하며, 이때 통계 값은 ImageNet 데이터 셋의 RGB 통계값을 이용할 것이다.

텐서화: 파이토치는 tensor자료 형을 이용하므로 totensor를 해준다.

augmentation: trainset에만 적용한다.

 

trainset에는 train_transformers를 적용해 데이터를 augmentation을 해주고

testset에는 test_trainformers를 적용해 Normalize한뒤에 텐서로 바꾸어주었다.

 

albumentation라이브러리와 함수들이 궁금하다면 밑에링크에 들어가보면 된다.

https://dohun-0714.tistory.com/29

 

python albumentation 라이브러리 설명

albumentation은 이미지를 손쉽게 augmentation 해주는 python 라이브러리이다. 다양한 영상변환 알고리즘을 제공하고 있고, 처리속도도 매우 빨라 딥러닝 전처리 용으로 유용하게 사용할 수 있다. A.Resize

dohun-0714.tistory.com

 

이어서 augmentation이 적용된사진을 다시 원래이미지로 되돌려보겠다.

728x90

댓글