程序示例精选
Python+Torch+FasterCNN网络目标检测识别
如需安装运行环境或远程调试,见文章底部个人QQ名片,由专业技术人员远程协助!
前言
这篇博客针对《Python+Torch+FasterCNN网络目标检测识别》编写代码,代码整洁,规则,易读。 学习与应用推荐首选。
运行结果
文章目录
一、所需工具软件
二、使用步骤
1. 主要代码
2. 运行结果
三、在线协助
一、所需工具软件
1. VS2019, Qt
2. C++
二、使用步骤
代码如下(示例):
# coding:utf-8
'''
import json
import shutil
data_root = './coco/'
with open(data_root+"annotations/instances_val2014.json", 'r') as f:
annos = json.load(f)
images = annos["images"]
imageid2image = {}
for image in images:
imageid2image[image['id']]=image
categories = annos['categories']
cateid2name={}
for cate in categories:
cateid2name[cate['id']] = cate['name']
image_final=[]
annos_final=[]
categories_final=[{
"id":1,
"name": "airplane"}]
image_id=1
anno_id=1
imgid2airplane={}
for anno in annos['annotations']:
if cateid2name[anno['category_id']] == 'airplane':
image_id_t = anno['image_id']
if image_id_t not in imgid2airplane:
imgid2airplane[image_id_t] = []
imgid2airplane[image_id_t].append(anno)
'mini_airplane/' + imagename)
image = imageid2image[imgid]
image['id'] = image_id
image_final.append(image)
for anno in annos:
anno["id"] = anno_id
anno["image_id"] = image_id
anno["category_id"] = 1
anno_id+=1
annos_final.append(anno)
image_id+=1
if image_id >=100:
break
instance = {"images": image_final,
"annotations":annos_final,
"categories": categories_final}
with open('mini_airplane_train.json', 'w') as f:
json.dump(instance, f, indent=1)
运行结果
三、在线协助:
如需安装运行环境或远程调试,见文章底部个人 QQ 名片,由专业技术人员远程协助!
1)远程安装运行环境,代码调试
2)Visual Studio, Qt, C++, Python编程语言入门指导
3)界面美化
4)软件制作
5)云服务器申请
6)网站制作
当前文章连接:https://blog.csdn.net/alicema1111/article/details/132666851
个人博客主页:https://blog.csdn.net/alicema1111?type=blog
博主所有文章点这里:https://blog.csdn.net/alicema1111?type=blog
博主推荐:
Python人脸识别考勤打卡系统:
https://blog.csdn.net/alicema1111/article/details/133434445
Python果树水果识别:https://blog.csdn.net/alicema1111/article/details/130862842
Python+Yolov8+Deepsort入口人流量统计:https://blog.csdn.net/alicema1111/article/details/130454430
Python+Qt人脸识别门禁管理系统:https://blog.csdn.net/alicema1111/article/details/130353433
Python+Qt指纹录入识别考勤系统:https://blog.csdn.net/alicema1111/article/details/129338432
Python Yolov5火焰烟雾识别源码分享:https://blog.csdn.net/alicema1111/article/details/128420453
Python+Yolov8路面桥梁墙体裂缝识别:https://blog.csdn.net/alicema1111/article/details/133434445