편집 기록

편집 기록
  • 프로필 nowp님의 편집
    날짜2020.09.17

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


        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
    

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

  • 프로필 알 수 없는 사용자님의 편집
    날짜2020.09.16

    label 오류


    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 label = labels[-1] IndexError: list index out of range 이결과가 나오는데 도움좀 주세요 뭔지 도저히 이해가안가네요 이걸 돌리면