# you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from utils.util import AttrDict, merge_cfg_from_args, get_arguments import os args = get_arguments() cfg = AttrDict() # 待预测图像所在路径 cfg.data_dir = os.path.join(args.example, "data", "test_images") # 待预测图像名称列表 cfg.data_list_file = os.path.join(args.example, "data", "test.txt") # 模型加载路径 cfg.model_path = os.path.join(args.example, "model") # 预测结果保存路径 cfg.vis_dir = os.path.join(args.example, "result") # 预测类别数 cfg.class_num = 2 # 均值, 图像预处理减去的均值 cfg.MEAN = 127.5, 127.5, 127.5 # 标准差,图像预处理除以标准差
# -*- coding: utf-8 -*- from utils.util import AttrDict, merge_cfg_from_args, get_arguments import os import sys sys.path.append("softwareOfPaddle/") args = get_arguments() cfg = AttrDict() with open("connfig.txt", "r") as cof: reader = cof.readlines() reader = [line.rstrip("\n") for line in reader] cfg.gpu = int(reader[1]) # 模型加载路径 cfg.model_path = reader[2] # 预测类别数 cfg.class_num = 19 # 均值, 图像预处理减去的均值 cfg.MEAN = 127.5, 127.5, 127.5 # 标准差,图像预处理除以标准差 cfg.STD = 127.5, 127.5, 127.5 # 待预测图像输入尺寸 cfg.input_size = int(reader[3].split(" ")[0]), int(reader[3].split(" ")[1]) merge_cfg_from_args(args, cfg)
# -*- coding: utf-8 -*- from utils.util import AttrDict, merge_cfg_from_args, get_arguments import os args = get_arguments() cfg = AttrDict() # 待预测图像所在路径 cfg.data_dir = os.path.join(args.example , "data", "testing_images") # 待预测图像名称列表 cfg.data_list_file = os.path.join(args.example , "data", "test_id.txt") # 模型加载路径 cfg.model_path = os.path.join(args.example , "ACE2P") # 预测结果保存路径 cfg.vis_dir = os.path.join(args.example , "result") # 预测类别数 cfg.class_num = 20 # 均值, 图像预处理减去的均值 cfg.MEAN = 0.406, 0.456, 0.485 # 标准差,图像预处理除以标准差 cfg.STD = 0.225, 0.224, 0.229 # 多尺度预测时图像尺寸 cfg.multi_scales = (377,377), (473,473), (567,567) # 多尺度预测时图像是否水平翻转 cfg.flip = True merge_cfg_from_args(args, cfg)
# -*- coding: utf-8 -*- from utils.util import AttrDict, merge_cfg_from_args, get_arguments import os args = get_arguments() args.example = "Road" cfg = AttrDict() cfg.model = "2" # mode0 不推理视屏流 mode1推理游戏截图视屏流 mode2推理本地视屏 cfg.mode = 0 cfg.use_gpu = True # 待预测图像所在路径 cfg.data_dir = os.path.join(args.example, "data", "test_images") # 待预测图像名称列表 cfg.data_list_file = os.path.join(args.example, "data", "test.txt") # 模型加载路径 cfg.model_path = os.path.join(args.example, "model/" + cfg.model) # 预测结果保存路径 cfg.vis_dir = os.path.join(args.example, "result") # 预测类别数 cfg.class_num = 19 # 均值, 图像预处理减去的均值 cfg.MEAN = 127.5, 127.5, 127.5 # 标准差,图像预处理除以标准差 cfg.STD = 127.5, 127.5, 127.5 # 待预测图像输入尺寸
# -*- coding: utf-8 -*- from utils.util import AttrDict, merge_cfg_from_args, get_arguments import os import sys sys.path.append("softwareOfPaddle/") args = get_arguments() cfg = AttrDict() with open("connfig.txt", "r") as cof: reader = cof.readlines() reader = [line.rstrip("\n") for line in reader] cfg.gpu = int(reader[1]) cfg.model_path = reader[2] cfg.run_mode = "fluid" merge_cfg_from_args(args, cfg)
# -*- coding: utf-8 -*- import os from utils.util import AttrDict, get_arguments, merge_cfg_from_args args = get_arguments() cfg = AttrDict() # 待预测图像所在路径 cfg.data_dir = os.path.join(args.example, "data", "test_images") # 待预测图像名称列表 cfg.data_list_file = os.path.join(args.example, "data", "test.txt") # 模型加载路径 cfg.model_path = os.path.join(args.example, "model") # 预测结果保存路径 cfg.vis_dir = os.path.join(args.example, "result") # 预测类别数 cfg.class_num = 2 # 均值, 图像预处理减去的均值 cfg.MEAN = 104.008, 116.669, 122.675 # 标准差,图像预处理除以标准差 cfg.STD = 1.0, 1.0, 1.0 # 待预测图像输入尺寸 cfg.input_size = 513, 513 merge_cfg_from_args(args, cfg)