inflearn logo
강의

Course

Instructor

TensorFlow Object Detection API Guide Part 1 - Detecting Objects with 10 Lines of Code

이미지 사이즈 에러 발생

547

hewun7427

1 asked

0

ValueError                                Traceback (most recent call last)
<ipython-input-36-bb063d6d7f72> in <module>()
      1 image_dir = 'images_person/'
      2 image_path = os.path.join(image_dir, 'person_picture:001.png')
----> 3 image_np = load_image_into_numpy_array(image_path)
      4 
      5 # 이미지에 대한 예측을 수행합니다.

<ipython-input-35-aa041491b700> in load_image_into_numpy_array(path)
     17 
     18   return np.array(image.getdata()).reshape(
---> 19       (im_height, im_width, 3)).astype(np.uint8)

ValueError: cannot reshape array of size 1344384 into shape (432,778,3)

제가 새로운 이미지파일로 object detection을 실행하고 있는데 사이즈가 달라서 오류가 나는거 같습니다.
어떻게 해결해야 하나요?

tensorflow 딥러닝 cnn

Answer 2

0

hewun7427

해결됐습니다.

감사합니다.

0

AISchool

안녕하세요~. 반갑습니다.

이미지가 RGB가 아니라 grayscale로 처리되어서 발생한 에러가 아닐까 의심됩니다.

load_image_into_numpy_array 함수안에 있는 아래 2줄을 아래와 같이 변경 해서 진행해보세요.

img_data = tf.io.gfile.GFile(path, 'rb').read()

image = Image.open(BytesIO(img_data))

->

image = Image.open(path).convert("RGB")

감사합니다.

[개정판] 딥러닝 컴퓨터 비전 완벽 가이드 먼저? 구현하며 배우는 Transformer 먼저?

0

29

1

수업자료

0

23

2

paperswithcode 서비스 종료 관련 문의

0

209

2

질문있습니다.

0

59

2

버전 오류 23.05파일 포함.

0

214

1

python -m pip install . 이 아예 안되서 전체 다 수행할 수 없습니다.

0

377

1

1강 colab 2022-11-11 파일도 안됩니다.

1

595

2

강의 슬라이드 전달 요청

1

373

1

TensorFlow Object Detection API Deprecation 영향 문의

0

366

0

1강_TF2_Detection_Model_ZOO_example_fasterrcnn_pedestrian_dataset.ipynb 내 파일 실행 실패

0

452

1

Person Detection 에러 질문

0

244

1

사용법

0

391

2

확장자 변경

0

271

0

Faster R-CNN을 이용한 Person Detection 에서 오류

0

283

1

mportError: cannot import name 'BaseRandomLayer' from 'keras.engine.base_layer' (/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py) 오류 문의합니다.

0

556

2

PPT자료 어디에 있나요??

0

306

0

실사가 아닌 경우에도 잘 검출이 될까요?

0

358

1

error

0

184

1

Person Detection 관련 문의

0

246

1

CenterNet을 이용한 Car Detection

0

229

0

Faster R-CNN을 이용한 Car Detection 코랩 링크 관련 문의

0

335

1

yolo annotation 문의

0

349

1

Average Recall 질문

0

525

1

강의 교재

0

307

1