当前位置:网站首页>[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
边栏推荐
- Audio and video technology development weekly | 232
- Defensive programming skills
- Value transfer communication between components (parent to child, child to parent, brother component to value)
- Which product is better if you want to go abroad to insure Xinguan?
- Sword finger offer:55 - I. depth of binary tree
- MySQL one master multiple slaves + linear replication
- Base d'apprentissage de la machine: sélection de fonctionnalités avec lasso
- JS object definition
- XSS prevention
- Learning video website
猜你喜欢

Summary of Chinese remainder theorem

1289_FreeRTOS中vTaskSuspend()接口实现分析

National standard gb28181 protocol platform easygbs fails to start after replacing MySQL database. How to deal with it?

150 ppt! The most complete "fair perception machine learning and data mining" tutorial, Dr. AIST Toshihiro kamishima, Japan

选择排序与冒泡排序模板

SQL語句加强練習(MySQL8.0為例)

Is it really so difficult to learn redis? Today, a fan will share his personal learning materials!

Don't disagree, this is the most powerful "language" of the Internet

PHP database connection succeeded, but data cannot be inserted

Www 2022 | taxoenrich: self supervised taxonomy complemented by Structural Semantics
随机推荐
MySQL backup notes
If you have just joined a new company, don't be fired because of your mistakes
AAAI2022 | Word Embeddings via Causal Inference: Gender Bias Reducing and Semantic Information Preserving
logistic regression
1289_FreeRTOS中vTaskSuspend()接口实现分析
Management and thesis of job management system based on SSM
Class summation, shortest row
New year's first race, submit bug reward more!
Add token validation in swagger
Consul of distributed service registration discovery and unified configuration management
The difference between MCU serial communication and parallel communication and the understanding of UART
CUDA basic knowledge
what does ctrl + d do?
warning: LF will be replaced by CRLF in XXXXXX
数据库SQL语句汇总,持续更新......
Which product is better for 2022 annual gold insurance?
Redis notes (I) Linux installation process of redis
Enhanced for loop
Is it really so difficult to learn redis? Today, a fan will share his personal learning materials!
Apple submitted the new MAC model to the regulatory database before the spring conference