Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
S
study
  • Overview
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • Snippets
    • Snippets
  • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Commits
  • Issue Boards
  • 최애림
  • study
  • Merge Requests
  • !1

Merged
Opened Apr 13, 2023 by 최애림@aerimchoi 
  • Report abuse
Report abuse

INNODEV-2812 Python 이해

  • restAPI를 활용한 OCR TEST
  • 인식 결과 파일 CSV로 저장
  • Discussion 7
  • Commits 4
  • Changes 7
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • 김영표
    @kyp2975 started a discussion Apr 14, 2023
    Resolved by 최애림 Apr 17, 2023
    • 김영표 @kyp2975 commented Apr 14, 2023
      Master

      코드를 아래 설명처럼 재구성 해보면 좋을 것 같습니다.

      1. 이미지 경로를 파라미터로 받아 ocr 인식 결과를 반환하는 def run_ocr(image_path) -> dict: 함수를 구현합니다.
      2. OCR 인식 결과와 저장할 csv파일명을 파라미터로 받아 csv파일 다운로드를 수행하는 def download_csv_file(ocr_result, output_file_path) -> None: 함수를 구현합니다.
      3. 이미지 폴더 목록과 결과 파일 저장 경로을 파라미터로 받아 이미지 폴더 내 파일을 위 run_ocr함수와 download_csv 함수를 호출하여 csv로 반환받는 def main(image_dir_path, output_dir_path) -> None 함수를 구현합니다.(csv 파일명은 이미지 이름과 동일하고 확장자만 다르게 지정합니다.)
      4. 전역변수로 선언된 변수들은 대문자로 선언합니다.
        이렇게 한번 코드를 변경해주세요
      코드를 아래 설명처럼 재구성 해보면 좋을 것 같습니다. 1. 이미지 경로를 파라미터로 받아 ocr 인식 결과를 반환하는 `def run_ocr(image_path) -> dict:` 함수를 구현합니다. 2. OCR 인식 결과와 저장할 csv파일명을 파라미터로 받아 csv파일 다운로드를 수행하는 `def download_csv_file(ocr_result, output_file_path) -> None:` 함수를 구현합니다. 3. 이미지 폴더 목록과 결과 파일 저장 경로을 파라미터로 받아 이미지 폴더 내 파일을 위 `run_ocr`함수와 `download_csv` 함수를 호출하여 csv로 반환받는 `def main(image_dir_path, output_dir_path) -> None` 함수를 구현합니다.(csv 파일명은 이미지 이름과 동일하고 확장자만 다르게 지정합니다.) 4. 전역변수로 선언된 변수들은 대문자로 선언합니다. 이렇게 한번 코드를 변경해주세요
    • 최애림 @aerimchoi commented Apr 17, 2023
      Master

      수정 완료했습니다.

      수정 완료했습니다.
    Please register or sign in to reply
  • 최애림 @aerimchoi

    added 1 commit

    • 670438b9 - -이미지 경로를 파라미터로 받아 ocr 인식결과를 반환하는 run_ocr 함수 생성

    Compare with previous version

    Apr 17, 2023

    added 1 commit

    • 670438b9 - -이미지 경로를 파라미터로 받아 ocr 인식결과를 반환하는 run_ocr 함수 생성

    Compare with previous version

    added 1 commit * 670438b9 - -이미지 경로를 파라미터로 받아 ocr 인식결과를 반환하는 run_ocr 함수 생성 [Compare with previous version](https://gitlab.synap.co.kr/aerimchoi/study/merge_requests/1/diffs?diff_id=83785&start_sha=20c840b1181a8e76d242424d0e65fc3ab0f3225f)
    Toggle commit list
  • 최애림 @aerimchoi

    added 2 commits

    • 242c698d - INNODEV-2812 Python 이해
    • 349dfadd - Merge branch 'issue/INNODEV-2812' of https://gitlab.synap.co.kr/aerimchoi/study…

    Compare with previous version

    Apr 17, 2023

    added 2 commits

    • 242c698d - INNODEV-2812 Python 이해
    • 349dfadd - Merge branch 'issue/INNODEV-2812' of https://gitlab.synap.co.kr/aerimchoi/study…

    Compare with previous version

    added 2 commits * 242c698d - INNODEV-2812 Python 이해 * 349dfadd - Merge branch 'issue/INNODEV-2812' of https://gitlab.synap.co.kr/aerimchoi/study… [Compare with previous version](https://gitlab.synap.co.kr/aerimchoi/study/merge_requests/1/diffs?diff_id=83787&start_sha=670438b980e016a2bd14459fb08741516469d866)
    Toggle commit list
  • 김영표
    @kyp2975 started a discussion on the diff Apr 17, 2023
    Resolved by 최애림 Apr 17, 2023
    restapi/ocrtest.py 0 → 100644
    1 import requests
    2 import json
    3 import os
    4
    5 # 엔진 경로 설정
    6 ENGINE_ADDRESS = 'http://192.168.1.149:62975'
    7
    8
    9 def run_ocr(image_path):
    • 김영표 @kyp2975 commented Apr 17, 2023
      Master

      python docstring 방식으로 함수마다 주석 추가 부탁드립니다.

      python docstring 방식으로 함수마다 주석 추가 부탁드립니다.
    • 최애림 @aerimchoi commented Apr 17, 2023
      Master

      수정 완료했습니다.

      수정 완료했습니다.
    Please register or sign in to reply
  • 김영표
    @kyp2975 started a discussion on the diff Apr 17, 2023
    Resolved by 최애림 Apr 17, 2023
    restapi/ocrtest.py 0 → 100644
    48 csv_file.write(res_content)
    49
    50
    51 def main(image_dir_path, output_dir_path):
    52 extension_li = ['png', 'jpg', 'jpeg']
    53 file_names = [file_name for file_name in os.listdir(image_dir_path) if file_name.split('.')[1] in extension_li]
    54
    55 # 반복 인식 후 저장
    56 for file_name in file_names:
    57 # 인식
    58 img_path = os.path.join(image_dir_path, file_name)
    59 ocr_result = run_ocr(img_path)
    60
    61 # csv파일 받고 저장
    62 output_file_path = os.path.join(output_dir_path, file_name.split('.')[0])
    63 download_csv_file(ocr_result, output_file_path)
    • 김영표 @kyp2975 commented Apr 17, 2023
      Master

      python argparse를 이용해 이미지 경로와 결과물 경로를 입력받도록 수정 부탁드립니다.

      python argparse를 이용해 이미지 경로와 결과물 경로를 입력받도록 수정 부탁드립니다.
    • 최애림 @aerimchoi commented Apr 17, 2023
      Master

      수정 완료했습니다.

      수정 완료했습니다.
    Please register or sign in to reply
  • 김영표 @kyp2975

    assigned to @aerimchoi

    Apr 17, 2023

    assigned to @aerimchoi

    assigned to @aerimchoi
    Toggle commit list
  • 최애림 @aerimchoi

    added 1 commit

    • cdb28ffd - INNODEV-2812 Python 이해

    Compare with previous version

    Apr 17, 2023

    added 1 commit

    • cdb28ffd - INNODEV-2812 Python 이해

    Compare with previous version

    added 1 commit * cdb28ffd - INNODEV-2812 Python 이해 [Compare with previous version](https://gitlab.synap.co.kr/aerimchoi/study/merge_requests/1/diffs?diff_id=83795&start_sha=242c698d88f31f7db0ebebbddb07e5e8a01d81d6)
    Toggle commit list
  • 최애림 @aerimchoi

    added 1 commit

    • 7137578f - INNODEV-2812 Python 이해

    Compare with previous version

    Apr 17, 2023

    added 1 commit

    • 7137578f - INNODEV-2812 Python 이해

    Compare with previous version

    added 1 commit * 7137578f - INNODEV-2812 Python 이해 [Compare with previous version](https://gitlab.synap.co.kr/aerimchoi/study/merge_requests/1/diffs?diff_id=83796&start_sha=cdb28ffdf6ac54a0e75aceebeac099c1d591c032)
    Toggle commit list
  • 최애림 @aerimchoi

    resolved all discussions

    Apr 17, 2023

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • 김영표 @kyp2975 commented Apr 19, 2023
    Master

    리뷰 완료했습니다.

    리뷰 완료했습니다.
  • 김영표 @kyp2975

    mentioned in commit 136cb64b

    Apr 19, 2023

    mentioned in commit 136cb64b

    mentioned in commit 136cb64be52697aef329e6ad90a05b2a2c29f626
    Toggle commit list
  • 김영표 @kyp2975

    merged

    Apr 19, 2023

    merged

    merged
    Toggle commit list
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment
최애림
Assignee
최애림 @aerimchoi
Assign to
None
Milestone
None
Assign milestone
Time tracking
2
2 participants
Reference: aerimchoi/study!1
×

Revert this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.
×

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.