Skip to content

Commit

Permalink
fix the issue of repeatedly downloading pretrained model (#12142)
Browse files Browse the repository at this point in the history
* fix the issue of repeatedly downloading pretrained model

* add log info
  • Loading branch information
GreatV authored May 20, 2024
1 parent 9602438 commit f5defab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ppocr/utils/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

def download_with_progressbar(url, save_path):
logger = get_logger()
if save_path and os.path.exists(save_path):
logger.info(f"Path {save_path} already exists. Skipping...")
return
response = requests.get(url, stream=True)
if response.status_code == 200:
total_size_in_bytes = int(response.headers.get("content-length", 1))
Expand Down

2 comments on commit f5defab

@yeenjie
Copy link

@yeenjie yeenjie commented on f5defab Sep 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个修改似乎导致了,用url传输图片,ppocr只会不断检测最开始的那张图片。因为tmp.jpg不会被覆盖。
PaddleOCR /paddleocr.py line571-576:
download_with_progressbar(img, "tmp.jpg")

@GreatV
Copy link
Collaborator Author

@GreatV GreatV commented on f5defab Sep 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yeenjie 这应该是前面指定"tmp.jpg"的问题,每次网络下载的文件名都是tmp.jpg。

Please sign in to comment.