label 오류, labels[-1], list index out of range

조회수 863회
    api_output = detect_text(frame)
    recoq = []
    for text in api_output :
        recoq.append(text.description)
    # print(recoq[0])

    pattern = "[0-9]{2}[가-힣]\s[0-9]{4}"
    pattern2 = "[0-9]{4}"
    match_pattern = re.search(pattern, recoq[0])
    match_number_list = re.findall(pattern2, recoq[0])
    if match_pattern :
        labels.append(match_pattern.group())
        label = match_pattern.group()
    elif not match_number_list :
        label = " none "
    else :
        label = labels[-1]
    # print("searched : ",label)
    #label = match_pattern.group()

    b,g,r,a = 0,0,0,0
    img_pil = Image.fromarray(frame)
    draw = ImageDraw.Draw(img_pil)
    draw.text((10, 10),  label, font=font, fill=(b,g,r,a))

    img = np.array(img_pil)

    # Remove the bounding boxes with low confidence
    img = postprocess(img, outs)
 File "dr.py", line 238, in <module>
    label = labels[-1]
IndexError: list index out of range

이결과가 나오는데 도움좀 주세요 뭔지 도저히 이해가안가네요 이걸 돌리면

1 답변

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)