当前位置: 首页 > news >正文

昆明做网站排名百度推广app下载安卓版

昆明做网站排名,百度推广app下载安卓版,自己电脑上做网站别人访问,自响应式网站建设清单参考 coco eval 解析 COCO目标检测比赛中的模型评价指标介绍! coco 的评估函数对应的是 pycocotools 中的 cocoeval.py 文件。 从整体上来看,整个 COCOeval 类的框架如图: 基础的用法为 # The usage for CocoEval is as follows: cocoGt…

参考

coco eval 解析
COCO目标检测比赛中的模型评价指标介绍!

coco 的评估函数对应的是 pycocotools 中的 cocoeval.py 文件。
从整体上来看,整个 COCOeval 类的框架如图:
在这里插入图片描述

基础的用法为

# The usage for CocoEval is as follows:
cocoGt=..., cocoDt=...       # load dataset and results
E = CocoEval(cocoGt,cocoDt); # initialize CocoEval object
E.params.recThrs = ...;      # set parameters as desired
E.evaluate();                # run per image evaluation
E.accumulate();              # accumulate per image results
E.summarize();               # display summary metrics of results

cocoGt, cocoDt 应该是什么格式?如果是COCO 格式,注意需要增加 score 值。(how?)

__init__ 初始化函数

参数解释如下:
在这里插入图片描述
注意几个字母的含义
N: 用于评估的img_id 的个数
K: 用于评估的cat_id 的个数
T: iouThrs 的个数
R: recThrs 的个数
A: 对象面积分段后的数量
M: maxDets 每张图片检测的最大检测框数量

_prepare

根据传入的初始化参数做一些前置化的处理

    def _prepare(self):'''Prepare ._gts and ._dts for evaluation based on params:return: None'''def _toMask(anns, coco):# modify ann['segmentation'] by referencefor ann in anns:rle = coco.annToRLE(ann)ann['segmentation'] = rlep = self.paramsif p.useCats:gts=self.cocoGt.loadAnns(self.cocoGt.getAnnIds(imgIds=p.imgIds, catIds=p.catIds))dts=self.cocoDt.loadAnns(self.cocoDt.getAnnIds(imgIds=p.imgIds, catIds=p.catIds))else:gts=self.cocoGt.loadAnns(self.cocoGt.getAnnIds(imgIds=p.imgIds))dts=self.cocoDt.loadAnns(self.cocoDt.getAnnIds(imgIds=p.imgIds))# convert ground truth to mask if iouType == 'segm'if p.iouType == 'segm':_toMask(gts, self.cocoGt)_toMask(dts, self.cocoDt)# set ignore flagfor gt in gts:gt['ignore'] = gt['ignore'] if 'ignore' in gt else 0gt['ignore'] = 'iscrowd' in gt and gt['iscrowd']if p.iouType == 'keypoints':gt['ignore'] = (gt['num_keypoints'] == 0) or gt['ignore']self._gts = defaultdict(list)       # gt for evaluationself._dts = defaultdict(list)       # dt for evaluationfor gt in gts:self._gts[gt['image_id'], gt['category_id']].append(gt)for dt in dts:self._dts[dt['image_id'], dt['category_id']].append(dt)self.evalImgs = defaultdict(list)   # per-image per-category evaluation resultsself.eval     = {}                  # accumulated evaluation results

computeIoU(self, imgId, catId):

根据image_id和cat_id计算这张图片里 cat_id 的所有GT、DT的iou矩阵,主要用于bbox和segmentation;
这里就是涉及到单张图片的单个类别的计算。

computeOks(self, imgId, catId):

根据image_id和cat_id计算这张图片里所有GT、DT的Oks矩阵,也就是Sec 1.2.里OKS的计算源码出处。这里OKS矩阵的维度是

OKS 矩阵是什么?

evaluateImg

对单张图片的单个类别做统计。
按照这个的话,我还是没有把预测结果转换为 coco json.

maxDets 每张图片的最大检测数
useCats 指定类别评估

cocoGt, cocoDt 都是 COCO API 数据

过程会计算每张图的结果吗?会的,每张图每个类别分别计算,最后汇总的。
在这里插入图片描述
evaluateImg来计算每一张图片、每一个类别在不同条件下的检测结果;

precision(T,R,K,A,M) recall(T,K,A,M)。
TKAM 分别是代表什么?什么意思?

cocoEval.evaluate() 只是每幅图的det和gt做了匹配,并将结果存在了self.evalImgs中。计算tp等指标需要cocoEval.accumulate()。

针对上述accumulate获得的precision、recall矩阵,在不同的维度上进行统计,然后再呈现结果。
函数内部会根据传入的具体的IoU阈值,面积阈值,最大检测数的值返回上述precision和recall中对应维的检测结果,我们就也可以自定义形式返回我们想要的各种参数下的AP与AR啦。

coco api 的 loadRes 怎么理解?
COCO API-COCO模块在det中的应用

结合 mmdet 中的 cocometric

mmdet/evaluation/metrics/coco_metric.py

result2json 将结果格式化为coco格式。

# convert predictions to coco format and dump to json file
result_files = self.results2json(preds, outfile_prefix)

/home/my_mmdet/demo/inference_demo.ipynb 已经给出了不同场景下的推理

  • 一张图片
  • 一个文件夹
    确认一下这两种情况是否经过了完整的 预处理?

确认 mmdet 预测的结果格式?
然后保留一份 json 作为 cocoeval 实验的example.

mmdet 中的 cocometric, 更像是一个过程评估器。
需要不断通过process的方式处理gt和pred?

先 process, 再 compute_metric?

模型在处理的过程中,会生成带有 metainfo,img_id 的预测结果。但是在自己调用 detinferencer 的时候却不会生成?为何?

  • 如何解决?让自己更容易简易调用数据结果?
  • dumpresult 为pkl是怎么实现的?

gt 也是在process 这个函数中的 data_batch 中加入的,额,不是,是在 datasamples 中返回的。

def process(self, data_batch: dict, data_samples: Sequence[dict]) -> None:"""Process one batch of data samples and predictions. The processedresults should be stored in ``self.results``, which will be used tocompute the metrics when all batches have been processed.Args:data_batch (dict): A batch of data from the dataloader.data_samples (Sequence[dict]): A batch of data samples thatcontain annotations and predictions."""for data_sample in data_samples:result = dict()pred = data_sample['pred_instances']result['img_id'] = data_sample['img_id']result['bboxes'] = pred['bboxes'].cpu().numpy()result['scores'] = pred['scores'].cpu().numpy()result['labels'] = pred['labels'].cpu().numpy()# encode mask to RLEif 'masks' in pred:result['masks'] = encode_mask_results(pred['masks'].detach().cpu().numpy()) if isinstance(pred['masks'], torch.Tensor) else pred['masks']# some detectors use different scores for bbox and maskif 'mask_scores' in pred:result['mask_scores'] = pred['mask_scores'].cpu().numpy()# parse gtgt = dict()gt['width'] = data_sample['ori_shape'][1]gt['height'] = data_sample['ori_shape'][0]gt['img_id'] = data_sample['img_id']if self._coco_api is None:# TODO: Need to refactor to support LoadAnnotationsassert 'instances' in data_sample, \'ground truth is required for evaluation when ' \'`ann_file` is not provided'gt['anns'] = data_sample['instances']# add converted result to the results listself.results.append((gt, result))

coco 接口

这两个接口是否可以帮助不通过json构造coco?

loadRes

将结果转换为 loadNumpyAnnotations 输入格式、

list:
ann 一定要求包括以下几个 key, score 以及别的key看你心情加?
- image_id
- segmentation
- bbox

- score??? 有score 吗?

loadNumpyAnnotations

def loadNumpyAnnotations(self, data):"""Convert result data from a numpy array [Nx7] where each row contains {imageID,x1,y1,w,h,score,class}:param  data (numpy.ndarray):return: annotations (python nested list)"""print('Converting ndarray to lists...')assert(type(data) == np.ndarray)print(data.shape)assert(data.shape[1] == 7)N = data.shape[0]ann = []for i in range(N):if i % 1000000 == 0:print('{}/{}'.format(i,N))ann += [{'image_id'  : int(data[i, 0]),'bbox'  : [ data[i, 1], data[i, 2], data[i, 3], data[i, 4] ],'score' : data[i, 5],'category_id': int(data[i, 6]),}]return ann

self.datasets

datasets 是个什么?

mask 这块是一个比较细节的地方

mmdet 返回的mask, 和我们输入的格式不同,一种是 polygon,还有一种?rle?
import pycocotools._mask as _mask

然后这个 mask 的解析, coco metrics 里已经给了一个案例了。
做了一个 annotation 出来而已。
下一步是写出来,然后是继续到最后,detect完整个逻辑(3小时?)

mAP 的计算中

其实有一个比较诡异的问题,边界case 是如何处理的?比如gt为0?dt为0?

计算每张图片的 mAP

# 计算每张图像的 mAPper_image_mAPs = []for img_id in coco_api.getImgIds():coco_eval.params.imgIds = [img_id]coco_eval.evaluate()coco_eval.accumulate()coco_eval.summarize()# 获取每张图像的 mAP 值per_image_mAPs.append(coco_eval.stats[1])# 打印每张图像的 mAP 值for i, mAP in enumerate(per_image_mAPs):print(f"mAP for image {i + 1}: {mAP}")

问题

  • iouType to ‘segm’, ‘bbox’ or ‘keypoints’ 有什么区别?
  • maxDets - [1 10 100] M=3 thresholds on max detections per image 这个需要根据实际情况调整吗?

文章转载自:
http://bedeswoman.c7622.cn
http://waftage.c7622.cn
http://undisturbed.c7622.cn
http://biramous.c7622.cn
http://circadian.c7622.cn
http://colloquium.c7622.cn
http://sacque.c7622.cn
http://upstart.c7622.cn
http://paperback.c7622.cn
http://distensile.c7622.cn
http://auscultate.c7622.cn
http://fogless.c7622.cn
http://sunday.c7622.cn
http://circumgyration.c7622.cn
http://granadilla.c7622.cn
http://ephemerous.c7622.cn
http://workgroup.c7622.cn
http://pectinose.c7622.cn
http://ibsenian.c7622.cn
http://indention.c7622.cn
http://vogue.c7622.cn
http://logy.c7622.cn
http://cosiness.c7622.cn
http://cursory.c7622.cn
http://flatfish.c7622.cn
http://heteroecism.c7622.cn
http://isotac.c7622.cn
http://rancherie.c7622.cn
http://taw.c7622.cn
http://saleslady.c7622.cn
http://peregrin.c7622.cn
http://retinoscopy.c7622.cn
http://musketeer.c7622.cn
http://sociologese.c7622.cn
http://intersperse.c7622.cn
http://rimple.c7622.cn
http://fargo.c7622.cn
http://machaira.c7622.cn
http://tree.c7622.cn
http://artifacts.c7622.cn
http://kwangchow.c7622.cn
http://microseism.c7622.cn
http://pericranium.c7622.cn
http://endorse.c7622.cn
http://telepherique.c7622.cn
http://xylophagous.c7622.cn
http://gangload.c7622.cn
http://zolotnik.c7622.cn
http://muso.c7622.cn
http://trichology.c7622.cn
http://poole.c7622.cn
http://coelenterate.c7622.cn
http://blewits.c7622.cn
http://haplopia.c7622.cn
http://chinois.c7622.cn
http://restuff.c7622.cn
http://phleboclysis.c7622.cn
http://regicide.c7622.cn
http://pentarchy.c7622.cn
http://infamatory.c7622.cn
http://carboxylic.c7622.cn
http://empathize.c7622.cn
http://bestiarian.c7622.cn
http://chopinesque.c7622.cn
http://nota.c7622.cn
http://cholesterol.c7622.cn
http://ungild.c7622.cn
http://pickaninny.c7622.cn
http://gca.c7622.cn
http://humblebee.c7622.cn
http://coprecipitation.c7622.cn
http://chenag.c7622.cn
http://diomed.c7622.cn
http://aqaba.c7622.cn
http://jukes.c7622.cn
http://bordeaux.c7622.cn
http://walkabout.c7622.cn
http://parquetry.c7622.cn
http://rubenesque.c7622.cn
http://ciminite.c7622.cn
http://reflorescence.c7622.cn
http://donjon.c7622.cn
http://spheriform.c7622.cn
http://bilharziasis.c7622.cn
http://rheological.c7622.cn
http://rougeot.c7622.cn
http://simultaneously.c7622.cn
http://sialomucin.c7622.cn
http://gifu.c7622.cn
http://dealfish.c7622.cn
http://yttriferous.c7622.cn
http://outbreed.c7622.cn
http://photoceramic.c7622.cn
http://locomote.c7622.cn
http://palomino.c7622.cn
http://polemonium.c7622.cn
http://cetrimide.c7622.cn
http://allocator.c7622.cn
http://cirrhotic.c7622.cn
http://assignation.c7622.cn
http://www.zhongyajixie.com/news/84119.html

相关文章:

  • 简述如何让网站排名快速提升搜索引擎营销的分类
  • 上海那家公司做响应式网站建设网站收录工具
  • 网站目录怎么做外链网络服务主要包括
  • 网站更改备案主体江苏网站推广
  • 网站建设推广和网络推广网站点击量 哪里查询
  • 创建网站有免费的吗宁德市公共资源交易中心
  • 互联网网站建设咨询电子商务与网络营销教案
  • 网站设置搜索关键字推广竞价托管公司
  • 做一个购物网站需要什么技术百度网站提交
  • 自己有网站怎么做点卡域名注册入口
  • 德兴网站建设公司seo岗位工资
  • 外国人做外贸都会浏览哪些网站石家庄seo关键词排名
  • 特价网站建设费用seo技术好的培训机构
  • 毕业设计论文网站开发需要多少钱seo知识培训
  • 公司的网站建设推广普通话的意义30字
  • 北京做网站周云帆百度快照怎么发布
  • 免费单页网站模板营销型企业网站有哪些平台
  • 网站如何做留言板头条发布视频成功显示404
  • 动漫设计与制作专业学校电商seo是什么
  • 邢台本地网站怎么宣传自己的店铺
  • 网站怎么做充值系统如何在百度发布广告信息
  • 做网站后台需要什么知识企业培训计划方案
  • 建站哪家好用兴田德润数字营销策略有哪些
  • 把网站做静态化正规优化公司哪家好
  • 在美国买云主机做网站关键词首页排名优化平台
  • 龙岗网站建设深圳信科2024年重大新闻简短
  • wordpress双语站企业qq邮箱
  • logo设计免费网址长沙正规竞价优化服务
  • 网站建设技术团队有多重要关键词seo
  • wordpress站内搜索次数seo优化流程