supermachine--tomato-passio.../20240627test4/config.py
TG 242bb9a71b feat:新增20240627test4为现场部署版本的测试版(包含传统方法、实例分割、目标检测、图像分类多个模型)
fix:修复在20240627test4中的classifier.py的analyze_tomato函数中white_defect的函数忘记传递两个阈值量的错误;修复analyze_tomato函数中的叶片实例分割存在的问题,解决由于变量污染引起的分割错误;
2024-07-21 22:17:46 +08:00

80 lines
2.4 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
# @Time : 2024/6/17 下午3:36
# @Author : TG
# @File : config.py
# @Software: PyCharm
from root_dir import ROOT_DIR
class Config:
#文件相关参数
#预热参数
n_spec_rows, n_spec_cols, n_spec_bands = 25, 30, 13
n_rgb_rows, n_rgb_cols, n_rgb_bands = 613, 800, 3
tomato_img_dir = ROOT_DIR / 'models' / 'TO.bmp'
passion_fruit_img_dir = ROOT_DIR / 'models' / 'PF.bmp'
#模型路径
#糖度模型
brix_model_path = ROOT_DIR / 'models' / 'passion_fruit.joblib'
#图像分类模型
imgclassifier_model_path = ROOT_DIR / 'models' / 'resnet18pf20240705.pth'
imgclassifier_class_indices_path = ROOT_DIR / 'models' / 'class_indices.json'
#番茄初版实例分割叶片模型,实例分割叶片
# toseg_weights = ROOT_DIR / 'weights' / 'raw_seg_best.pt'
#20240711番茄新版实例分割模型实例分割叶片、果蒂、果脐处
toseg_weights = ROOT_DIR / 'weights' / '20240711_seg_best.pt'
#番茄初版裂口目标检测模型,原始包含刀划伤的模型
# toobj_path = ROOT_DIR / 'weights' / 'raw_obj_best.pt'
#20240711番茄新版裂口目标检测模型去除刀划伤的模型
# toobj_path = ROOT_DIR / 'weights' / '20240711_obj_best.pt'
#20240712番茄新版裂口目标检测模型去除刀划伤的模型新增加坑状破损样本
toobj_path = ROOT_DIR / 'weights' / '20240712_obj_best.pt'
#classifer.py参数
#tomato
find_reflection_threshold = 190
extract_g_r_factor = 1.5
#passion_fruit
hue_value = 37
hue_delta = 10
value_target = 25
value_delta = 10
#提取绿色像素参数
low_H = 0
low_S = 100
low_V = 0
high_H = 60
high_S = 180
high_V = 60
#spec_predict
#筛选谱段并未使用在qt取数据时已经筛选
selected_bands = [8, 9, 10, 48, 49, 50, 77, 80, 103, 108, 115, 143, 145]
#data_processing
#根据标定数据计算的参数,实际长度/像素长度单位cm
pixel_length_ratio = 6.3/425
#绿叶面积阈值,高于此阈值认为连通域是绿叶
area_threshold = 20000
#百香果密度g/cm^3
density = 0.652228972
#百香果面积比例每个像素代表的实际面积cm^2
area_ratio = 0.00021973702422145334
#def analyze_tomato
#s_l通道阈值
threshold_s_l = 180
threshold_fore_g_r_t = 20