model与部分图片移至static下

This commit is contained in:
zhbaor 2024-11-12 12:46:09 +08:00
parent 78e6cca458
commit 40dd9c1f32
108 changed files with 106 additions and 365 deletions

View file

@ -376,7 +376,7 @@ class Arknights数据处理器:
im = cv2.erode(im, np.ones((5, 5)))
template[operator] = im
with lzma.open("mower/models/recruit_result.pkl", "wb") as f:
with lzma.open("mower/static/recruit_result.pkl", "wb") as f:
pickle.dump(template, f)
def load_recruit_tag(self):
@ -398,7 +398,7 @@ class Arknights数据处理器:
recruit_tag_template[tag] = cv2.cvtColor(
np.array(im.crop(im.getbbox())), cv2.COLOR_RGB2BGR
)
with lzma.open("./mower/models/recruit.pkl", "wb") as f:
with lzma.open("./mower/static/recruit.pkl", "wb") as f:
pickle.dump(recruit_tag_template, f)
def 输出_公招资源(self):
@ -452,9 +452,9 @@ class Arknights数据处理器:
和添加物品至前端文件() 有联动 添加物品提供了分类的图片位置"""
self.训练仓库的knn模型("NORMAL", "./mower/models/NORMAL.pkl")
self.训练仓库的knn模型("CONSUME", "./mower/models/CONSUME.pkl")
self.训练仓库的knn模型("MATERIAL", "./mower/models/MATERIAL.pkl")
self.训练仓库的knn模型("NORMAL", "./mower/static/NORMAL.pkl")
self.训练仓库的knn模型("CONSUME", "./mower/static/CONSUME.pkl")
self.训练仓库的knn模型("MATERIAL", "./mower/static/MATERIAL.pkl")
def 输出_在房间内的干员名的模型(self):
font = ImageFont.truetype("mower/fonts/SourceHanSansCN-Medium.otf", 37)
@ -483,7 +483,7 @@ class Arknights数据处理器:
# cv2.imwrite(f"/home/zhao/Desktop/data/{operator}.png", tpl)
data[operator] = tpl
with lzma.open("mower/models/operator_room.model", "wb") as f:
with lzma.open("mower/static/operator_room.model", "wb") as f:
pickle.dump(data, f)
def avatar_and_portrait(self, save_img=False):
@ -530,7 +530,7 @@ class Arknights数据处理器:
kp, des = fast_keypoints(full, mask)
pt = [p.pt for p in kp]
data = {"w": w, "h": h, "col": col, "name": name_list, "pt": pt, "des": des}
with lzma.open(f"./mower/models/{name}.pkl", "wb") as f:
with lzma.open(f"./mower/static/{name}.pkl", "wb") as f:
pickle.dump(data, f)
extract("avatar", ((20, 51), (160, 146)))
@ -666,7 +666,7 @@ class Arknights数据处理器:
def levels(self):
levels_json = 加载json("./ArknightsGameResource/levels.json")
with lzma.open("mower/models/levels.pkl", "wb") as f:
with lzma.open("mower/static/levels.pkl", "wb") as f:
pickle.dump(levels_json, f)
def 读取模组(self):