perfect version2

This commit is contained in:
li.zhenye 2022-08-02 15:41:47 +08:00
parent 0e297c892c
commit fe5eececc2
2 changed files with 3 additions and 3 deletions

View File

@ -168,5 +168,5 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Run image test or ') parser = argparse.ArgumentParser(description='Run image test or ')
tester = TestMain() tester = TestMain()
tester.pony_run(test_path=r'/home/lzy/2022.7.30/tobacco_v1_0/saved_img/', tester.pony_run(test_path=r'/home/lzy/2022.7.30/tobacco_v1_0/saved_img/',
test_rgb=False, test_spectra=False, get_delta=False) test_rgb=True, test_spectra=True, get_delta=False)

View File

@ -260,7 +260,7 @@ class PixelModelML:
self.dt = pickle.load(f) self.dt = pickle.load(f)
def predict(self, feature): def predict(self, feature):
pixel_result_array = self.dt.predict(feature) pixel_result_array = self.dt.predict_bin(feature)
return pixel_result_array return pixel_result_array
@ -409,7 +409,7 @@ class SpecDetector(Detector):
if x_yellow.shape[0] == 0: if x_yellow.shape[0] == 0:
return non_yellow_things return non_yellow_things
else: else:
tobacco = self.pixel_model_ml.predict_bin(x_yellow) < 0.5 tobacco = self.pixel_model_ml.predict(x_yellow) < 0.5
non_yellow_things[yellow_things] = ~tobacco non_yellow_things[yellow_things] = ~tobacco
# 杂质mask中将背景赋值为0,将杂质赋值为1 # 杂质mask中将背景赋值为0,将杂质赋值为1