mirror of
https://github.com/NanjingForestryUniversity/supermachine-tobacco.git
synced 2025-11-08 06:13:53 +00:00
调整mask大小为1024*1024,且更换了rgb背景的模型
This commit is contained in:
parent
b752bea8d4
commit
4bf6f50c61
@ -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"
|
||||
]
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user