mirror of
https://github.com/NanjingForestryUniversity/supermachine-tobacco.git
synced 2025-11-08 06:13:53 +00:00
屏蔽了右侧10个喷阀
This commit is contained in:
parent
2af3d8091f
commit
f2c614dbcf
@ -12,24 +12,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": 7,
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"name": "stderr",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"C:\\Users\\FEIJINTI\\miniconda3\\envs\\cv\\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": [
|
"source": [
|
||||||
"import numpy as np\n",
|
"import numpy as np\n",
|
||||||
"import scipy\n",
|
"import scipy\n",
|
||||||
@ -46,7 +30,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 2,
|
"execution_count": 8,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"train_from_existed = False # 是否从现有数据训练,如果是的话,那就从dataset_file训练,否则就用data_dir里头的数据\n",
|
"train_from_existed = False # 是否从现有数据训练,如果是的话,那就从dataset_file训练,否则就用data_dir里头的数据\n",
|
||||||
@ -86,7 +70,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 3,
|
"execution_count": 9,
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"dataset = read_labeled_img(data_dir, color_dict=color_dict, is_ps_color_space=False)\n",
|
"dataset = read_labeled_img(data_dir, color_dict=color_dict, is_ps_color_space=False)\n",
|
||||||
@ -193,7 +177,7 @@
|
|||||||
" data = scipy.io.loadmat(dataset_file)\n",
|
" data = scipy.io.loadmat(dataset_file)\n",
|
||||||
" x, y = data['x'], data['y'].ravel()\n",
|
" x, y = data['x'], data['y'].ravel()\n",
|
||||||
" model.fit(x, y=y, is_generate_negative=False, model_selection='dt')\n",
|
" model.fit(x, y=y, is_generate_negative=False, model_selection='dt')\n",
|
||||||
"else:8\n",
|
"else:\n",
|
||||||
" world_boundary = np.array([0, 0, 0, 255, 255, 255])\n",
|
" world_boundary = np.array([0, 0, 0, 255, 255, 255])\n",
|
||||||
" model.fit(x, world_boundary, threshold, negative_sample_size=negative_sample_num, train_size=0.7,\n",
|
" model.fit(x, world_boundary, threshold, negative_sample_size=negative_sample_num, train_size=0.7,\n",
|
||||||
" is_save_dataset=True, model_selection='dt')\n",
|
" is_save_dataset=True, model_selection='dt')\n",
|
||||||
|
|||||||
2
main.py
2
main.py
@ -124,7 +124,7 @@ def main(only_spec=False, only_color=False, if_merge=False, interval_time=None,
|
|||||||
mask_rgb = rgb_detector.predict(rgb_data).astype(np.uint8)
|
mask_rgb = rgb_detector.predict(rgb_data).astype(np.uint8)
|
||||||
masks = [mask_spec, mask_rgb]
|
masks = [mask_spec, mask_rgb]
|
||||||
# 进行多个喷阀的合并
|
# 进行多个喷阀的合并
|
||||||
masks = [utils_customized.shield_valve(mask, left_shield=10) for mask in masks]
|
masks = [utils_customized.shield_valve(mask, left_shield=10, right_shield=10) for mask in masks]
|
||||||
masks = [utils_customized.valve_expend(mask) for mask in masks]
|
masks = [utils_customized.valve_expend(mask) for mask in masks]
|
||||||
mask_nums = sum([np.sum(np.sum(mask)) for mask in masks])
|
mask_nums = sum([np.sum(np.sum(mask)) for mask in masks])
|
||||||
log_time_count += 1
|
log_time_count += 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user