From 4bf6f50c6146e6a2eefe4628084808bf8dc0a087 Mon Sep 17 00:00:00 2001 From: FEIJINTI <83849113+FEIJINTI@users.noreply.github.com> Date: Mon, 22 Aug 2022 22:21:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4mask=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E4=B8=BA1024*1024,=E4=B8=94=E6=9B=B4=E6=8D=A2=E4=BA=86rgb?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E7=9A=84=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 02_classification.ipynb | 42 ++++++++++++++++++++++++++++------------- config.py | 4 ++-- models/__init__.py | 2 +- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/02_classification.ipynb b/02_classification.ipynb index 6fd34e3..d72197f 100644 --- a/02_classification.ipynb +++ b/02_classification.ipynb @@ -12,8 +12,24 @@ }, { "cell_type": "code", - "execution_count": 7, - "outputs": [], + "execution_count": 1, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "C:\\Users\\FEIJINTI\\miniconda3\\envs\\deepo\\lib\\site-packages\\tqdm\\auto.py:22: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", + " from .autonotebook import tqdm as notebook_tqdm\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Training env\n" + ] + } + ], "source": [ "import numpy as np\n", "import scipy\n", @@ -30,7 +46,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 2, "outputs": [], "source": [ "train_from_existed = False # 是否从现有数据训练,如果是的话,那就从dataset_file训练,否则就用data_dir里头的数据\n", @@ -70,7 +86,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 3, "outputs": [], "source": [ "dataset = read_labeled_img(data_dir, color_dict=color_dict, is_ps_color_space=False)\n", @@ -99,7 +115,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 4, "outputs": [], "source": [ "if len(dataset) > 1:\n", @@ -130,7 +146,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 5, "outputs": [], "source": [ "# 对数据进行预处理\n", @@ -147,13 +163,13 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 6, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "31173it [01:21, 380.30it/s] \n" + "147099it [31:23, 78.09it/s] \n" ] }, { @@ -162,12 +178,12 @@ "text": [ " precision recall f1-score support\n", "\n", - " 0 1.00 1.00 1.00 9352\n", - " 1 1.00 1.00 1.00 7793\n", + " 0 1.00 1.00 1.00 44129\n", + " 1 1.00 1.00 1.00 36775\n", "\n", - " accuracy 1.00 17145\n", - " macro avg 1.00 1.00 1.00 17145\n", - "weighted avg 1.00 1.00 1.00 17145\n", + " accuracy 1.00 80904\n", + " macro avg 1.00 1.00 1.00 80904\n", + "weighted avg 1.00 1.00 1.00 80904\n", "\n" ] } diff --git a/config.py b/config.py index fd3115e..eb8e4e1 100644 --- a/config.py +++ b/config.py @@ -26,7 +26,7 @@ class Config: # rgb模型参数 rgb_tobacco_model_path = r"weights/tobacco_dt_2022-08-05_10-38.model" - rgb_background_model_path = r"weights/background_dt_2022-08-09_16-08.model" + rgb_background_model_path = r"weights/background_dt_2022-08-22_22-15.model" threshold_low, threshold_high = 10, 230 threshold_s = 190 # 饱和度的最高允许值 rgb_size_threshold = 4 # rgb的尺寸限制 @@ -34,7 +34,7 @@ class Config: ai_conf_threshold = 0.5 # mask parameter - target_size = (256, 1024) # (Width, Height) of mask + target_size = (1024, 1024) # (Width, Height) of mask valve_merge_size = 2 # 每两个喷阀当中有任意一个出现杂质则认为都是杂质 valve_horizontal_padding = 3 # 喷阀横向膨胀的尺寸,应该是奇数,3时表示左右各膨胀1 max_open_valve_limit = 25 # 最大同时开启喷阀限制,按照电流计算,当前的喷阀可以开启的喷阀 600W的电源 / 12V电源 = 50A, 一个阀门1A diff --git a/models/__init__.py b/models/__init__.py index 1fa6a10..0a53b49 100755 --- a/models/__init__.py +++ b/models/__init__.py @@ -21,7 +21,7 @@ from detector import SugarDetect from utils import lab_scatter, read_labeled_img, size_threshold -deploy = True +deploy = False if not deploy: print("Training env") from tqdm import tqdm