From 02d222f479ac61bb58521d8d73e964c2af6dd54c Mon Sep 17 00:00:00 2001 From: duanmu <774052669@qq.com> Date: Wed, 15 Mar 2023 22:52:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=B0=83=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classifer.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/classifer.py b/classifer.py index e4f43cc..7b3473d 100755 --- a/classifer.py +++ b/classifer.py @@ -31,7 +31,7 @@ import utils FEATURE_INDEX = [0, 1, 2] delete_columns = 10 # 已弃用 -num_bins = 10 +num_bins = 7 class WoodClass(object): @@ -293,14 +293,14 @@ class WoodClass(object): x = np.concatenate((x, x_hsv), axis=2) x = np.reshape(x, (x.shape[0] * x.shape[1], x.shape[2])) - x = x[np.argsort(x[:, 0])] - x = x[-self.k:, :] + # x = x[np.argsort(x[:, 0])] + # x = x[-self.k:, :] - # hist, bins = np.histogram(x[:, 0], bins=num_bins) - # hist = hist[1:] - # bins = bins[1:] - # hist_number = np.argmax(hist) - # x = x[(x[:, 0] > bins[hist_number]) & (x[:, 0] < bins[hist_number + 1]), :] + hist, bins = np.histogram(x[:, 0], bins=num_bins) + hist = hist[1:] + bins = bins[1:] + hist_number = np.argmax(hist) + x = x[(x[:, 0] > bins[hist_number]) & (x[:, 0] < bins[hist_number + 1]), :] if debug_mode: # self.log.log(x)