yolov3 中的anchor 的框框是在训练集中聚类所得,在yolov3 中每个格子有9个anchor
 mask52=    [0,1,2]mask26= [3,4,5]mask13= [6,7,8]anchors=[ 10,13, 16,30, 33,23,30,61, 62,45, 59,119,116,90, 156,198, 373,326]
  • yolov3 有9个anchor 点
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 19 20:54:27 2021@author: ledi
"""#!/usr/bin/env python
# -*- coding:utf-8 -*-
import cv2
def showPrioriBox():#输入图片尺寸INPUT_SIZE = 416mask52=    [0,1,2]mask26= [3,4,5]mask13= [6,7,8]#0--->(10,13) #1--->(16,30) .....anchors=[ 10,13, 16,30, 33,23,30,61, 62,45, 59,119,116,90, 156,198, 373,326]FEATURE_MAP_SIZE=26SHOW_ALL_FLAG  = True  # 显示所有的方框GRID_SHOW_FLAG =True# cap = cv2.VideoCapture("street.jpg")picPath = './car.jpg'picName = picPath.split('/')[-1]img = cv2.imread(picPath)print("original img.shape: ",img.shape)  # (1330, 1330, 3)img = cv2.resize(img,(INPUT_SIZE, INPUT_SIZE))# 显示网格if GRID_SHOW_FLAG:height, width, channels = img.shapeGRID_SIZEX =  int(INPUT_SIZE/FEATURE_MAP_SIZE)for x in range(0, width - 1, GRID_SIZEX):cv2.line(img, (x, 0), (x, height), (150, 150, 255), 1, 1)  # x gridGRID_SIZEY = int(INPUT_SIZE / FEATURE_MAP_SIZE)for y in range(0, height - 1, GRID_SIZEY):cv2.line(img, (0, y), (width, y), (150, 150, 255), 1, 1)  # x grid# END:显示网格
#       cv2.imshow('Hehe', img)
#       cv2.imwrite('./' + picName.split('.')[0] + '_grid.' + picName.split('.')[1], img)if SHOW_ALL_FLAG or FEATURE_MAP_SIZE==13:for ele in mask13:# print(ele)# import cv2    图片   起点     终点      颜色      厚度# cv2.rectangle(img, (x1, y1), (x2, y2), (255,0,0),  2   )# x1,y1 ------# |          |# |          |# |          |# --------x2,y2cv2.rectangle(img, (int(INPUT_SIZE * 0.5 - 0.5*anchors[ ele * 2]), int(INPUT_SIZE * 0.5 -  0.5*anchors[ ele * 2 + 1])   ),(int(INPUT_SIZE * 0.5 + 0.5*anchors[ ele * 2]),int(INPUT_SIZE * 0.5 + 0.5*anchors[ ele * 2 + 1])), (0, 255-ele*10, 0), 2)# cv2.imwrite('./' + picName.split('.')[0] + '_saveMask13.' + picName.split('.')[1], img)# cv2.imshow('img', img)if SHOW_ALL_FLAG or FEATURE_MAP_SIZE==26:for ele in mask26:# print(ele)cv2.rectangle(img, (int(INPUT_SIZE * 0.5 - 0.5*anchors[ ele * 2]), int(INPUT_SIZE * 0.5 -  0.5*anchors[ ele * 2 + 1])   ),(int(INPUT_SIZE * 0.5 + 0.5*anchors[ ele * 2]),int(INPUT_SIZE * 0.5 + 0.5*anchors[ ele * 2 + 1])          ), (255, 255-ele*10, 0), 2)# cv2.imwrite('./' + picName.split('.')[0] + '_saveMask26.' + picName.split('.')[1], img)if SHOW_ALL_FLAG or FEATURE_MAP_SIZE==52:for ele in mask52:# print(ele)cv2.rectangle(img, (int(INPUT_SIZE * 0.5 - 0.5*anchors[ ele * 2]), int(INPUT_SIZE * 0.5 -  0.5*anchors[ ele * 2 + 1])    ),(int(INPUT_SIZE * 0.5 + 0.5*anchors[ ele * 2]),int(INPUT_SIZE * 0.5 + 0.5*anchors[ ele * 2 + 1])), (0, 255-ele*10, 255), 1)# cv2.imwrite('./' + picName.split('.')[0] + '_saveMask52.' + picName.split('.')[1], img)cv2.imwrite('./' + picName.split('.')[0] + '_allSave.' + picName.split('.')[1], img)cv2.imshow('img', img)while cv2.waitKey(1000) != 27:  # loop if not get ESC.if cv2.getWindowProperty('img', cv2.WND_PROP_VISIBLE) <= 0:breakcv2.destroyAllWindows()if __name__ == '__main__':showPrioriBox()

yolov3 anchor 理解相关推荐

  1. Yolov3参数理解

    1.yolov3-voc.cfg(参考很多文章写的汇总,有些写了但还是不是很懂,如果有误请及时指正) [net] # Testing 测试模式 # batch=1 # subdivisions=1 # ...

  2. 怎么理解anchor?

    前言:这是知乎:faster rcnn中rpn的anchor,sliding windows,proposals之间的联系是什么?问题下的一个回答,这个回答首先解决了anchor是什么(what)的问 ...

  3. YOLOv3: 训练自己的数据(绝对经典版本1)

    为什么80%的码农都做不了架构师?>>>    windows版本:请参考:https://github.com/AlexeyAB/darknet linux       版本:请参 ...

  4. 『论文笔记』TensorFlow1.6.0+Keras 2.1.5+Python3.5+Yolov3训练自己的数据集!

    TensorFlow1.6.0+Keras 2.1.5+Python3.5+Yolov3训练自己的数据集! 文章目录 前期准备 一. Yolov3简要介绍 1.1. Yolov3网络结构图 1.2. ...

  5. YOLOv3: 训练自己的数据

    windows版本:请参考:https://github.com/AlexeyAB/darknet linux       版本:请参考本文与 https://pjreddie.com/darknet ...

  6. 转载:YOLOv3: 训练自己的数据

    转载 **感谢nusit_305大神的杰作 https://blog.csdn.net/lilai619/article/details/79695109** linux                ...

  7. YoLov3训练自己的数据集(小白手册)

    工具:labelimg.MobaXterm 1.标注自己的数据集.用labelimg进行标注,保存后会生成与所标注图片文件名相同的xml文件,如图.我们标注的是各种表,名称就简单的按外观大小分了s.m ...

  8. Windows下使用Yolov3(GPU)训练+测试自己的数据集

    Windows下使用Yolov3(GPU)训练+测试自己的数据集 1.配置Yolov3 参考:Windows下使用darknet.exe跑通Yolov3 Window10+VS2017+CUDA10. ...

  9. YOLOv3训练自己的数据

    本文转载自:nusit_305的博客 点击打开链接 第一部分:论文与代码 第二部分:如何训练自己的数据 第三部分:疑惑解释 第四部分:测试相关 第一部分:论文与代码 论  文:https://pjre ...

最新文章

  1. 2021山西高考成绩位次查询,2021年山西高考位次查询及一分一段表排名查询
  2. HttpWatch7.0测试工具
  3. mybatis-plus sql注入原理
  4. windows linux 子系统折腾记
  5. 【MyBatis框架】SqlMapConfig剖析
  6. matlab约束转非约束,请问:fmincon非等和等于的约束条件
  7. 每日算法系列【LeetCode 309】最佳买卖股票时机含冷冻期
  8. 终极邮件搜索群发大师 v3.47 绿色
  9. 【刘润五分钟商学院】-163生存,还是灭亡,没有中间态
  10. android代码 qq语音,仿QQ语音变声功能实现(二)---移植到android studio 并解决部分问题...
  11. Linux--进程与任务管理
  12. 托福高频真词List09 // 附托福TPO阅读真题
  13. python如何询问用户是否继续游戏_Python猜猜游戏如何再现
  14. 用JsonParser解析json树模型
  15. 【JavaScript】offset、client、scroll
  16. 求生之路2服务器ip直连,正版求生之路2好友直连显示该会话已不可用,无法联机...
  17. 【厚积薄发系列】C++项目总结15—字符集不同导致第三方库接口无法解析问题分析
  18. 电脑桌面计算机总是自动打开,电脑开机后自动打开很多软件怎么办
  19. emWin在PC上的模拟
  20. 【视频点播】阿里云视频点播如何获取视频播放的URL

热门文章

  1. 采用IpIq控制方法和电流空间和电压空间的PWM方法控制
  2. 基于MATLAB的costas载波同步+gardner时间同步,QPSK调制
  3. 八、TFTP服务器搭建及应用
  4. CF993E:Nikita and Order Statistics(FFT)
  5. 5分钟快速打造WebRTC视频聊天转
  6. Angular2学习笔记——NgModule
  7. WP8.1学习系列(第一章)——添加应用栏
  8. UBUNTU无法播放mp4格式电影的烦恼-是否可行待验证
  9. 赛门铁克公告:解密Kneber恶意软件
  10. fping的使用方法