• 카테고리

    질문 & 답변
  • 세부 분야

    컴퓨터 비전

  • 해결 여부

    해결됨

font 에러 관련 질문 (for window 10, local)

21.04.25 15:00 작성 조회수 262

0

detected_img = yolo.detect_image(img)

plt.imshow(detected_img) 의 코드를 실행하였더니 OSError가 발생합니다.

window10 환경인데 어떻게 해야

강의 폴더 내에 있는 FiraMono-Medium.otf를 인식시킬 수 있을까요?

(416, 416, 3)
Found 19 boxes for img
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-34-4f14924e2a84> in <module>
----> 1 detected_img = yolo.detect_image(img)
      2 plt.imshow(detected_img)

C:\JupyterNotebook\DLCV\Detection\yolo\keras-yolo3\yolo.py in detect_image(self, image)
    128 
    129         font = ImageFont.truetype(font='font/FiraMono-Medium.otf',
--> 130                     size=np.floor(3e-2 * image.size[1] + 0.5).astype('int32'))
    131         thickness = (image.size[0] + image.size[1]) // 300
    132 

~\anaconda3\envs\tf115\lib\site-packages\PIL\ImageFont.py in truetype(font, size, index, encoding, layout_engine)
    851 
    852     try:
--> 853         return freetype(font)
    854     except OSError:
    855         if not isPath(font):

~\anaconda3\envs\tf115\lib\site-packages\PIL\ImageFont.py in freetype(font)
    848 
    849     def freetype(font):
--> 850         return FreeTypeFont(font, size, index, encoding, layout_engine)
    851 
    852     try:

~\anaconda3\envs\tf115\lib\site-packages\PIL\ImageFont.py in __init__(self, font, size, index, encoding, layout_engine)
    208                     return
    209             self.font = core.getfont(
--> 210                 font, size, index, encoding, layout_engine=layout_engine
    211             )
    212         else:

OSError: cannot open resource

답변 1

답변을 작성해보세요.

0

안녕하십니까,

keras-yolo3 디렉토리 아래의 font 디렉토리를 상위 디렉토리로 복사하면 됩니다.

아래는 리눅스 os 명령어 입니다만(참조를 위해서 적습니다),  윈도우에서는 탐색기로 복사해서 옮기시면 됩니다.

cd ~/DLCV/Detection/yolo

cp -rf keras-yolo3/font ./font

감사합니다.