当前位置:网站首页>About the principle and code implementation of Siou (review IOU, giou, Diou, CIO)
About the principle and code implementation of Siou (review IOU, giou, Diou, CIO)
2022-06-11 06:25:00 【Sauerkraut with ginger】
The paper :https://arxiv.org/pdf/2205.12740.pdf
Code implementation ( unofficial ):https://github.com/xialuxi/yolov5-car-plate/commit/aa41d1819b1fb03b4dc73e8a3e0000c46cfc370b
Pictures from video tutorials ( This big guy video tutorial yyds):https://www.bilibili.com/video/BV1yi4y1g7ro?p=4
principle :
From the earliest IoU To GIoU, Until then DIoU and CIoU, Now there is SIoU
L2 Loss and IoU Comparison of losses 
GIoU Loss

A Represents the blue box , The largest rectangle .u representative GT Union with the prediction box .
DIoU Loss

On the left side of picture 1 is GIoU, The following is DIoU: Black stands for anchor, Blue represents the prediction box , The green one is GT box

CIoU Loss


SIoU Loss
On the basis of the above, the angle is considered 
The paper also redefines the distance cost and shape cost,
angle cost The definition is as follows :
The strange thing I see here is , This α Why bring into sin, And brought into the negative sin, Isn't that an unnecessary move ?σ Is the distance between the centers of the two boxes .
distance cost The definition is as follows :
shape cost The definition is as follows :
Whole lost Definition :
There are still many details not analyzed 、 mining 、 discuss , Here is just a cursory sharing , Record .
Code implementation :
!!! Important things are to be repeated for 3 times , I didn't realize , I didn't realize , I didn't realize . From the big guy at the beginning of the link :
if SIoU: # SIoU Loss https://arxiv.org/pdf/2205.12740.pdf
sigma = torch.pow(cw ** 2 + ch ** 2, 0.5)
sin_alpha_1 = ch / sigma
sin_alpha_2 = cw / sigma
threshold = pow(2, 0.5) / 2
sin_alpha = torch.where(sin_alpha_1 > threshold, sin_alpha_2, sin_alpha_1)
# angle_cost = 1 - 2 * torch.pow( torch.sin(torch.arcsin(sin_alpha) - np.pi/4), 2)
angle_cost = torch.cos(torch.arcsin(sin_alpha) * 2 - np.pi / 2)
rho_x = ((b2_x1 + b2_x2 - b1_x1 - b1_x2) / cw) ** 2
rho_y = ((b2_y1 + b2_y2 - b1_y1 - b1_y2) / ch) ** 2
gamma = 2 - angle_cost
distance_cost = 2 - torch.exp(-1 * gamma * rho_x) - torch.exp(-1 * gamma * rho_y)
omiga_w = torch.abs(w1 - w2) / torch.max(w1, w2)
omiga_h = torch.abs(h1 - h2) / torch.max(h1, h2)
shape_cost = torch.pow(1 - torch.exp(-1 * omiga_w), 4) + torch.pow(1 - torch.exp(-1 * omiga_h), 4)
return iou - 0.5 * (distance_cost + shape_cost)
边栏推荐
- Sentinel annotation support - @sentinelresource usage details
- Ethical discussion on reptile Technology
- Instanceof and type conversion
- Super explanation
- FPGA设计中提高工作频率及降低功耗题目合集
- MATLAB realizes mean filtering and FPGA for comparison, and uses Modelsim waveform simulation
- Handwriting promise [03] - realize multiple calls and chain calls of then method
- Growth Diary 01
- FMT package usage of go and string formatting
- CCF 2013 12-4 interesting numbers
猜你喜欢

Autojs, read one line, delete one line, and stop scripts other than your own

FPGA interview notes (II) -- synchronous asynchronous D flip-flop, static and dynamic timing analysis, frequency division design, retiming

Fix the problem that the right mouse button does not have a vscode shortcut

Vulnhub's breach1.0 range exercise

How to use the markdown editor

EasyGBS接入的设备视频直播突然全部无法播放是为什么?数据库读写不够

Detailed steps for installing mysql-5.6.16 64 bit green version

347. top k high frequency elements

Examinelistactivity of Shandong University project training

Record the first data preprocessing process
随机推荐
FPGA设计中提高工作频率及降低功耗题目合集
Topic collection of FIFO minimum depth calculation
Continuous update of ansible learning
This point of arrow function
[reading this article is enough!!! Easy to understand] confidence level understanding (95% confidence level and confidence interval)
Instanceof and type conversion
617. 合并二叉树
Using Metasploit Trojan horse for remote control
PHP processing tree and infinite processing
Chapter 1 of machine learning [series] linear regression model
Teach you to write word formula
Sqoop installation tutorial
Sentinel annotation support - @sentinelresource usage details
Basic use of BufferedReader and bufferedwriter
Deployment of Flink
FPGA interview notes (III) -- implementation of handshake signal synchronization in cross clock domain, arbitrary frequency division, binary conversion, RAM memory, original code inversion and complem
Sqli-libs range 23-24 filtration and secondary injection practice
FMT package usage of go and string formatting
Detailed installation instructions for MySQL
022-Redis数据库0基础入门