Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: bubbliiiing/yolo3-keras
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.1
Choose a base ref
...
head repository: bubbliiiing/yolo3-keras
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 16 commits
  • 11 files changed
  • 1 contributor

Commits on Apr 28, 2022

  1. update voc_annotation.py

    bubbliiiing committed Apr 28, 2022
    Copy the full SHA
    9676502 View commit details

Commits on May 1, 2022

  1. Copy the full SHA
    5e62438 View commit details
  2. Copy the full SHA
    2cf3da0 View commit details

Commits on May 2, 2022

  1. update comment

    bubbliiiing committed May 2, 2022
    Copy the full SHA
    8bc7a96 View commit details

Commits on May 4, 2022

  1. update voc_annotation.py

    bubbliiiing committed May 4, 2022
    Copy the full SHA
    7d74410 View commit details

Commits on May 6, 2022

  1. update map

    bubbliiiing committed May 6, 2022
    Copy the full SHA
    6dc261c View commit details
  2. delete tools

    bubbliiiing committed May 6, 2022
    Copy the full SHA
    333b0ad View commit details
  3. Copy the full SHA
    6547b97 View commit details
  4. map count

    bubbliiiing committed May 6, 2022
    Copy the full SHA
    78e87db View commit details
  5. update utils_map

    bubbliiiing committed May 6, 2022
    Copy the full SHA
    1d314f1 View commit details
  6. Copy the full SHA
    8ceca37 View commit details

Commits on May 11, 2022

  1. update eval when train

    bubbliiiing committed May 11, 2022
    Copy the full SHA
    aaa9e23 View commit details

Commits on Jun 1, 2022

  1. update readme

    bubbliiiing committed Jun 1, 2022
    Copy the full SHA
    dc30015 View commit details

Commits on Jun 7, 2022

  1. update train.py

    bubbliiiing committed Jun 7, 2022
    Copy the full SHA
    cf3f66d View commit details

Commits on Jul 7, 2022

  1. update show config

    bubbliiiing committed Jul 7, 2022
    Copy the full SHA
    cb7d106 View commit details

Commits on Oct 23, 2022

  1. update readme

    bubbliiiing committed Oct 23, 2022
    Copy the full SHA
    02d0b94 View commit details
Showing with 587 additions and 172 deletions.
  1. +1 −0 .gitignore
  2. +4 −1 README.md
  3. +0 −113 _tools/convert.py
  4. +37 −12 get_map.py
  5. +15 −4 summary.py
  6. +62 −20 train.py
  7. +164 −1 utils/callbacks.py
  8. +214 −0 utils/utils.py
  9. +41 −19 utils/utils_map.py
  10. +44 −0 voc_annotation.py
  11. +5 −2 yolo.py
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ Medical_Datasets/
lfw/
logs/
model_data/
.temp_map_out/

# Byte-compiled / optimized / DLL files
__pycache__/
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -28,8 +28,11 @@ Efficientnet-Yolo3 | https://github.com/bubbliiiing/efficientnet-yolo3-keras
YoloV4 | https://github.com/bubbliiiing/yolov4-keras
YoloV4-tiny | https://github.com/bubbliiiing/yolov4-tiny-keras
Mobilenet-Yolov4 | https://github.com/bubbliiiing/mobilenet-yolov4-keras
YoloV5 | https://github.com/bubbliiiing/yolov5-keras
YoloV5-V5.0 | https://github.com/bubbliiiing/yolov5-keras
YoloV5-V6.1 | https://github.com/bubbliiiing/yolov5-v6.1-keras
YoloX | https://github.com/bubbliiiing/yolox-keras
YoloV7 | https://github.com/bubbliiiing/yolov7-keras
Yolov7-tiny | https://github.com/bubbliiiing/yolov7-tiny-keras

## 性能情况
| 训练数据集 | 权值文件名称 | 测试数据集 | 输入图片大小 | mAP 0.5:0.95 | mAP 0.5 |
113 changes: 0 additions & 113 deletions _tools/convert.py

This file was deleted.

49 changes: 37 additions & 12 deletions get_map.py
Original file line number Diff line number Diff line change
@@ -4,17 +4,17 @@
from PIL import Image
from tqdm import tqdm

from yolo import YOLO
from utils.utils import get_classes
from utils.utils_map import get_coco_map, get_map
from yolo import YOLO

if __name__ == "__main__":
'''
Recall和Precision不像AP是一个面积的概念,在门限值不同时,网络的Recall和Precision值是不同的。
map计算结果中的Recall和Precision代表的是当预测时,门限置信度为0.5时,所对应的Recall和Precision值。
Recall和Precision不像AP是一个面积的概念,因此在门限值(Confidence)不同时,网络的Recall和Precision值是不同的。
默认情况下,本代码计算的Recall和Precision代表的是当门限值(Confidence)为0.5时,所对应的Recall和Precision值。
此处获得的./map_out/detection-results/里面的txt的框的数量会比直接predict多一些,这是因为这里的门限低,
目的是为了计算不同门限条件下的Recall和Precision值,从而实现map的计算。
受到mAP计算原理的限制,网络在计算mAP时需要获得近乎所有的预测框,这样才可以计算不同门限条件下的Recall和Precision值
因此,本代码获得的map_out/detection-results/里面的txt的框的数量一般会比直接predict多一些,目的是列出所有可能的预测框,
'''
#------------------------------------------------------------------------------------------------------------------#
# map_mode用于指定该文件运行时计算的内容
@@ -25,16 +25,41 @@
# map_mode为4代表利用COCO工具箱计算当前数据集的0.50:0.95map。需要获得预测结果、获得真实框后并安装pycocotools才行
#-------------------------------------------------------------------------------------------------------------------#
map_mode = 0
#-------------------------------------------------------#
#--------------------------------------------------------------------------------------#
# 此处的classes_path用于指定需要测量VOC_map的类别
# 一般情况下与训练和预测所用的classes_path一致即可
#-------------------------------------------------------#
#--------------------------------------------------------------------------------------#
classes_path = 'model_data/voc_classes.txt'
#-------------------------------------------------------#
# MINOVERLAP用于指定想要获得的mAP0.x
#--------------------------------------------------------------------------------------#
# MINOVERLAP用于指定想要获得的mAP0.x,mAP0.x的意义是什么请同学们百度一下。
# 比如计算mAP0.75,可以设定MINOVERLAP = 0.75。
#-------------------------------------------------------#
#
# 当某一预测框与真实框重合度大于MINOVERLAP时,该预测框被认为是正样本,否则为负样本。
# 因此MINOVERLAP的值越大,预测框要预测的越准确才能被认为是正样本,此时算出来的mAP值越低,
#--------------------------------------------------------------------------------------#
MINOVERLAP = 0.5
#--------------------------------------------------------------------------------------#
# 受到mAP计算原理的限制,网络在计算mAP时需要获得近乎所有的预测框,这样才可以计算mAP
# 因此,confidence的值应当设置的尽量小进而获得全部可能的预测框。
#
# 该值一般不调整。因为计算mAP需要获得近乎所有的预测框,此处的confidence不能随便更改。
# 想要获得不同门限值下的Recall和Precision值,请修改下方的score_threhold。
#--------------------------------------------------------------------------------------#
confidence = 0.001
#--------------------------------------------------------------------------------------#
# 预测时使用到的非极大抑制值的大小,越大表示非极大抑制越不严格。
#
# 该值一般不调整。
#--------------------------------------------------------------------------------------#
nms_iou = 0.5
#---------------------------------------------------------------------------------------------------------------#
# Recall和Precision不像AP是一个面积的概念,因此在门限值不同时,网络的Recall和Precision值是不同的。
#
# 默认情况下,本代码计算的Recall和Precision代表的是当门限值为0.5(此处定义为score_threhold)时所对应的Recall和Precision值。
# 因为计算mAP需要获得近乎所有的预测框,上面定义的confidence不能随便更改。
# 这里专门定义一个score_threhold用于代表门限值,进而在计算mAP时找到门限值对应的Recall和Precision值。
#---------------------------------------------------------------------------------------------------------------#
score_threhold = 0.5
#-------------------------------------------------------#
# map_vis用于指定是否开启VOC_map计算的可视化
#-------------------------------------------------------#
@@ -64,7 +89,7 @@

if map_mode == 0 or map_mode == 1:
print("Load model.")
yolo = YOLO(confidence = 0.001, nms_iou = 0.5)
yolo = YOLO(confidence = confidence, nms_iou = nms_iou)
print("Load model done.")

print("Get predict result.")
@@ -104,7 +129,7 @@

if map_mode == 0 or map_mode == 3:
print("Get map.")
get_map(MINOVERLAP, True, path = map_out_path)
get_map(MINOVERLAP, True, score_threhold = score_threhold, path = map_out_path)
print("Get map done.")

if map_mode == 4:
19 changes: 15 additions & 4 deletions summary.py
Original file line number Diff line number Diff line change
@@ -2,14 +2,25 @@
# 该部分代码用于看网络结构
#--------------------------------------------#
from nets.yolo import yolo_body
from utils.utils import net_flops

if __name__ == "__main__":
input_shape = [416, 416, 3]
input_shape = [416, 416]
anchors_mask = [[6, 7, 8], [3, 4, 5], [0, 1, 2]]
num_classes = 80

model = yolo_body(input_shape, anchors_mask, num_classes)

model = yolo_body([input_shape[0], input_shape[1], 3], anchors_mask, num_classes)
#--------------------------------------------#
# 查看网络结构网络结构
#--------------------------------------------#
model.summary()

#--------------------------------------------#
# 计算网络的FLOPS
#--------------------------------------------#
net_flops(model, table=False)

#--------------------------------------------#
# 获得网络每个层的名称与序号
#--------------------------------------------#
# for i,layer in enumerate(model.layers):
# print(i,layer.name)
Loading