도토리 줍는 개발자 감자
python Corrupt JPEG data: premature end of data segment warning 이미지 깨짐 확인하기 본문
컴퓨터비전관련
python Corrupt JPEG data: premature end of data segment warning 이미지 깨짐 확인하기
감._.자 2024. 3. 27. 14:40728x90
반응형
Corrupt JPEG data: premature end of data segment warning은 warning이기 때문에 학습할 때 문제가 되지 않음.
하지만 위 warning은 이미지가 깨진것을 의미함.
이를 위해 cv2.imread()를 사용하여 모든 이미지를 확인하면서 try: ~ exception:~ 로 어떤 이미지 경로인지 찾아낼 수 없음. (나는 못했음) 왜냐하면 에러가 아니니까 try에서 못잡음.
결론적으로 내가 해결한 방법은 아래와 같다.
from skimage import io 를 임포트하고 아래와 같이 이미지를 불러오면 깨진 이미지에서 에러가 잡힘.
이때 except 에서 에러가 뜬 이미지 경로가 뜨게 하면됨.
from skimage import io
try:
img = io.imread(img_file)
except:
print("Cannot load : {}".format(img_file))
728x90
반응형
'컴퓨터비전관련' 카테고리의 다른 글
semantic segmentation cityscapes cite에서 test 성능 측정하기 (1) | 2023.01.24 |
---|---|
pycharm sh file 디버깅 방법 (1) | 2022.09.27 |
Loss nan 값 나올 때 (0) | 2022.09.27 |
RuntimeError: CUDA error: device-side assert triggered 에러.. (0) | 2022.09.19 |
[CUDA error 해결하기] RuntimeError: CUDA error: out of memory / For debugging consider passing CUDA_LAUNCH_BLOCKING=1. (1) | 2022.04.14 |
Comments