【faster rcnn 实现via的自动框人】使用detectron2中faster rcnn 算法生成人的坐标,将坐标导入via(VGG Image Annotator)中,实现自动框选出人的区域

本文介绍如何利用detectron2的Faster R-CNN算法生成人像坐标,结合VGG Image Annotator (VIA)实现自动标注。通过在detectron2中运行faster rcnn,导出坐标到via格式,简化大量人像的标注工作。详细步骤包括detectron2的安装、faster rcnn的运行、via的使用以及坐标转换过程。
摘要由CSDN通过智能技术生成

前言

B站讲解视频
我的研究生毕业论文方向就是时空行为检测,所以,slowfast和ava是我重点搞的,我的博客主页也有很多这些相关内容。

终于,到了标注数据这一块了,为了更简单的标注数据,我要做的这部分的数据包含大量的人,每张图片有30到40个人,如果要手动框人,再做行为标注,那是非常大的工作量,为了减小工作量,先使用faster rcnn把人的坐标算出来,然后倒入via中,实现算法的自动框人。

1 准备

1.1 detectron2安装及faster rcnn运行

1.1.1 detectron2官方网站

1.1.2 安装步骤

安装:

pip install -U torch torchvision cython
pip install -U 'git+https://github.com/facebookresearch/fvcore.git' 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'
git clone https://github.com/facebookresearch/detectron2 detectron2_repo
pip install -e detectron2_repo

1.1.3 Faster RCNN目标检测

在终端输入:

python3 demo.py --config-file ../configs/COCO-Detection/faster_rcnn_R_50_FPN_3x.yaml \
  --input ../img/1.jpg \
  --output ../img/1_1.jpg \
  --opts MODEL.WEIGHTS detectron2://COCO-Detection/faster_rcnn_R_50_FPN_3x/137849458/model_final_280758.pkl

1.1.4 参考

【Faster RCNN & detectron2】detectron2实现Faster RCNN目标检测

1.2 via的安装及使用

安装很简单,下载下来后,点开via.html就可以了

下载及使用指南:via官网

我下载的是2.0的版本,如下
在这里插入图片描述

2 faster rcnn 算法导出人类候选框为via格式

2.1 新建python脚本

在目录/detectron2_repo/demo/下新建一个python脚本,名字为:myvia.py

在这里插入图片描述
将下面的代码复制到myvia.py中

#Copyright (c) Facebook, Inc. and its affiliates.
import argparse
import glob
import multiprocessing as mp
import os
import time
import cv2
import tqdm
import os

from detectron2.config import get_cfg
from detectron2.data.detection_utils import read_image
from detectron2.utils.logger import setup_logger

from predic
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

青年夏日科技

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值