最终版本

master
UnknownObject 2 years ago
parent 2f97072a55
commit 257fb99811

@ -15,8 +15,7 @@ from PIL import Image
def open_image(image_path):
img = Image.open(image_path)
img_cvt = img.resize((460,460))
return img
return img_cvt
def predict_image(image_path):
# 加载模型
@ -36,7 +35,6 @@ def predict_image(image_path):
def train():
data_path = Path('G:\\Users\\15819\\Desktop\\Images2')
export_path = Path('G:\\Users\\15819\\Desktop')
blocks = (ImageBlock, CategoryBlock)
batch_size = 32
dls = DataBlock(
@ -53,7 +51,7 @@ def train():
model.export('G:\\Users\\15819\\Desktop\\model01.pkl')
def main():
#train()
train()
image_path = 'G:\\Users\\15819\\Desktop\\Images2\\SmallCar\\京M88888.jpg'
pred_class, confidence = predict_image(image_path)

Loading…
Cancel
Save