代码拉取完成,页面将自动刷新
同步操作将从 穿着帆布鞋也能走猫步/YOLOv3-Training-Snowman-Detector 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
from PIL import Image
import requests
import csv
import subprocess
def get_file(url, local_filename):
attempts = 0
while attempts < 3:
try:
r = requests.get(url)
with open(local_filename, 'wb') as f:
f.write(r.content)
f.close()
img = Image.open(local_filename)
break
except:
attempts += 1
print("Attempt#" + str(attempts) + " - Failed to read from "+url)
try:
img = Image.open(local_filename)
img.verify()
except Exception as e:
print(e)
print(local_filename + " corrupted..deleting it..")
subprocess.run(['rm', local_filename])
return
with open('/home/xuxuejie/software/YOLOv3-Training-Snowman-Detector/snowmanDataLinks.csv', 'r') as csvfile:
#with open('snowmantestLinks.csv', 'r') as csvfile:
urlreader = csv.reader(csvfile, delimiter=',')
for row in urlreader:
get_file(row[0], 'JPEGImages/' + row[1])
print(row[0] + '-->' + row[1])
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。