当前位置:网站首页>[paddleseg source code reading] paddleseg calculation dice
[paddleseg source code reading] paddleseg calculation dice
2022-07-04 03:37:00 【Master Fuwen】
D i c e Dice Dice Coefficient is a set similarity measure function , It is usually used to calculate the similarity of two sets , The value range is [ 0 , 1 ] [0, 1] [0,1]:
D i c e ( X , Y ) = 2 ∣ X ∩ Y ∣ ∣ X ∣ + ∣ Y ∣ Dice(X, Y) = \frac {2 | X\cap Y|} { |X| + |Y| } Dice(X,Y)=∣X∣+∣Y∣2∣X∩Y∣
∣ . ∣ |.| ∣.∣ Represents a function that takes the number of set elements
D i c e ( X , Y ) = two person hand over Set element plain Of individual Count × 2 two person element plain Count The amount And and Dice(X, Y) = \frac { The number of elements where the two intersect \times 2} { Sum of the two elements } Dice(X,Y)= two person element plain Count The amount And and two person hand over Set element plain Of individual Count ×2
PaddleSeg In the implementation of :
def dice(intersect_area, pred_area, label_area):
""" Calculate DICE. Calculation DICE value . Args: intersect_area (Tensor): The intersection area of prediction and ground truth on all classes. pred_area (Tensor): The prediction area on all classes. label_area (Tensor): The ground truth area on all classes. Returns: np.ndarray: DICE on all classes. float: mean DICE of all classes. """
# Transform the three into np.adarray
intersect_area = intersect_area.numpy()
pred_area = pred_area.numpy()
label_area = label_area.numpy()
# The number of two set elements
union = pred_area + label_area
class_dice = []
for i in range(len(intersect_area)): # Start iterating in each class
if union[i] == 0:
# If the molecule is 0, That is, the current image has no such elements
dice = 0
else:
dice = (2 * intersect_area[i]) / union[i]
class_dice.append(dice)
mdice = np.mean(class_dice)
return np.array(class_dice), mdice
intersect_area, pred_area, label_area These three parameters are passed :
calculate_area(pred, label, num_classes, ignore_index=255)
Calculated , Follow up with a blog :
[PaddleSeg Source code reading ] PaddleSeg Calculation mIoU
边栏推荐
- EV6 helps the product matrix, and Kia is making efforts in the high-end market. The global sales target in 2022 is 3.15 million?
- MySQL query
- Leecode 122. Zuijia timing of buying and selling stocks ②
- Day05 錶格
- Detailed explanation of PPTC self recovery fuse
- Is it really so difficult to learn redis? Today, a fan will share his personal learning materials!
- Code Execution Vulnerability - no alphanumeric rce create_ function()
- This function has none of DETERMINISTIC, NO SQL..... (you *might* want to use the less safe log_bin_t
- MySQL backup notes
- Short math guide for latex by Michael downs
猜你喜欢

How about the ratings of 2022 Spring Festival Gala in all provinces? Map analysis helps you show clearly!

If you have just joined a new company, don't be fired because of your mistakes

Rhcsa day 3

@Scheduled scheduled tasks

Summary of Chinese remainder theorem

functools下的reduce函数

Rhcsa day 2

Package details_ Four access control characters_ Two details of protected

Jenkins configures IP address access

Leetcode51.n queen
随机推荐
Code Execution Vulnerability - no alphanumeric rce create_ function()
Class summation, shortest row
Learning video website
A review of reverse reinforcement learning at Virginia Tech (VT)
Nbear introduction and use diagram
Consul of distributed service registration discovery and unified configuration management
[untitled]
What is the difference between enterprise wechat applet and wechat applet
機器學習基礎:用 Lasso 做特征選擇
If you have just joined a new company, don't be fired because of your mistakes
What kind of experience is it when the Institute earns 20000 yuan a month!
Katalon框架测试web(二十六)自动发邮件
How to use STR function of C language
Stm32bug [the project references devices, files or libraries that are not installed appear in keilmdk]
Objective-C description method and type method
[PaddleSeg 源码阅读] PaddleSeg 自定义数据类
投资深度思考
Typical applications of minimum spanning tree
The difference between MCU serial communication and parallel communication and the understanding of UART
MySQL maxscale realizes read-write separation