mirror of
https://github.com/NanjingForestryUniversity/supermachine-wood.git
synced 2025-11-08 10:13:53 +00:00
添加了qt传输模型名称的功能
This commit is contained in:
parent
b12bb52a6d
commit
363443ae94
@ -97,7 +97,7 @@ class WoodClass(object):
|
|||||||
sample = cv2.resize(x, (self.ww, self.hh))
|
sample = cv2.resize(x, (self.ww, self.hh))
|
||||||
return sample
|
return sample
|
||||||
|
|
||||||
def fit_pictures(self, data_path=ROOT_DIR):
|
def fit_pictures(self, data_path=ROOT_DIR, file_name=None):
|
||||||
"""
|
"""
|
||||||
根据给出的data_path 进行 fit.如果没有给出data目录,那么将会使用当前文件夹
|
根据给出的data_path 进行 fit.如果没有给出data目录,那么将会使用当前文件夹
|
||||||
:param data_path:
|
:param data_path:
|
||||||
@ -110,7 +110,7 @@ class WoodClass(object):
|
|||||||
x, y = result
|
x, y = result
|
||||||
score = self.fit(x, y)
|
score = self.fit(x, y)
|
||||||
print('model score', score)
|
print('model score', score)
|
||||||
model_name = self.save()
|
model_name = self.save(file_name)
|
||||||
return model_name
|
return model_name
|
||||||
|
|
||||||
def fit(self, x, y, test_size=0.1):
|
def fit(self, x, y, test_size=0.1):
|
||||||
|
|||||||
@ -33,8 +33,12 @@ def process_cmd(cmd: str, data: any, connected_sock: socket.socket, detector: Wo
|
|||||||
response = simple_sock(connected_sock, cmd_type=cmd, result=wood_color)
|
response = simple_sock(connected_sock, cmd_type=cmd, result=wood_color)
|
||||||
elif cmd == 'TR':
|
elif cmd == 'TR':
|
||||||
detector = WoodClass(w=4096, h=1200, n=3000, debug_mode=False)
|
detector = WoodClass(w=4096, h=1200, n=3000, debug_mode=False)
|
||||||
|
model_name = None
|
||||||
|
if "/n" in data:
|
||||||
|
data, model_name = data.split("/n", 1)
|
||||||
|
model_name = model_name + ".p"
|
||||||
settings.data_path = data
|
settings.data_path = data
|
||||||
settings.model_path = ROOT_DIR / 'models' / detector.fit_pictures(data_path=settings.data_path)
|
settings.model_path = ROOT_DIR / 'models' / detector.fit_pictures(data_path=settings.data_path, file_name=model_name)
|
||||||
response = simple_sock(connected_sock, cmd_type=cmd)
|
response = simple_sock(connected_sock, cmd_type=cmd)
|
||||||
elif cmd == 'MD':
|
elif cmd == 'MD':
|
||||||
settings.model_path = data
|
settings.model_path = data
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user