利用图像识别电视尺寸的模型
dlg-home-content的Python项目详细描述
dlg家庭内容
设置环境
- 在
在conda env create -f environment.yml
- 在
从源安装detectron2
在 - 在
cpu版本
在
> conda install pytorch torchvision cpuonly -c pytorch > python -m pip install detectron2 -f \ https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.6/index.html > update environment `conda env update --file environment.yml`
- 对于其他gpu版本,请使用this
可用的CLI命令
- 转换labelme2co
- 使用自定义数据集训练
我们需要定义三个配置文件
- detectron上可用的基本cfg文件名。查看
detectron/configs
以获取示例。在 - 包含修改参数的cfg文件。查看
configs
文件夹中的特定示例 - 具有数据集和关键点相关参数的data_cfg。例如
assets/datasets.yml
# normal instance segmentation custom_train --base_cfg 'COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml' --cfg 'configs/mask_only_exp1.yml' --data_cfg "assets/datasets.yml"# instance segmentation with keypoints custom_train --base_cfg 'COCO-Keypoints/keypoint_rcnn_R_50_FPN_3x.yaml' --cfg 'configs/keypoint_mask_on_exp1.yml' --data_cfg "assets/datasets.yml"
推论
徽标检测
从here下载最新的推理文件
fromdlg_home_content.tv_detectionimportInferLogoconfig='../assets/e2e_infer.ymlmodel=InferLogo(config)model.predict(img_loc,visualize=True)
关键点检测推断
从[此处](https://fractalanalytic-my.sharepoint.com/:u:/g/personal/sindhura_k_fractal_ai/EXCaFSHWv3hMo99lvfP4zKIBLBO8dlnWzY7iUAFWYiXHKA?e=23XheZ)下载权重文件和配置文件
#for inner keyoint detection from dlg_home_content.inference_pipeline import KeypointInference config='../assets/e2e_infer.yml'#kp_type in ['kp_inner_edge','kp_outer_edge','kp_sticky_note']model_inner= KeypointInference(config, kp_type='kp_inner_edge')predicted_keyoints= model_inner.predict_keypoints(img_loc, visualize=True)
端到端推理管道
fromdlg_home_content.e2e_inferenceimportE2EInferenceconfig='../assets/e2e_infer.yml'final_pipeline=E2EInference(config)result=final_pipeline.infer(img_loc,8,8,True)
- 项目
标签: