当前位置:网站首页>[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
边栏推荐
- What kind of experience is it when the Institute earns 20000 yuan a month!
- What is cloud primordial?
- 2022 Guangxi provincial safety officer a certificate examination materials and Guangxi provincial safety officer a certificate simulation test questions
- 基于PHP的轻量企业销售管理系统
- 150 ppt! The most complete "fair perception machine learning and data mining" tutorial, Dr. AIST Toshihiro kamishima, Japan
- How to use websocket to realize simple chat function in C #
- Audio and video technology development weekly | 232
- Which product is better if you want to go abroad to insure Xinguan?
- 機器學習基礎:用 Lasso 做特征選擇
- In my spare time, I like to write some technical blogs and read some useless books. If you want to read more of my original articles, you can follow my personal wechat official account up technology c
猜你喜欢

渗透实战-guest账户-mimikatz-向日葵-sql提权-离线解密

Rhcsa day 3

Practical multifunctional toolbox wechat applet source code / support traffic master

微信公众号网页授权

New year's first race, submit bug reward more!

Setting methods, usage methods and common usage scenarios of environment variables in postman

Exercices de renforcement des déclarations SQL (MySQL 8.0 par exemple)

Package details_ Four access control characters_ Two details of protected

Have you entered the workplace since the first 00???

@Scheduled scheduled tasks
随机推荐
(practice C language every day) pointer sorting problem
新型数据中心,助力加快构建以数据为关键要素的数字经济
智慧地铁| 云计算为城市地铁交通注入智慧
Enhanced for loop
GUI Graphical user interface programming (XIV) optionmenu - what do you want your girlfriend to wear on Valentine's day
Consul of distributed service registration discovery and unified configuration management
Exercices de renforcement des déclarations SQL (MySQL 8.0 par exemple)
Slurm view node configuration information
Is online futures account opening safe and reliable? Which domestic futures company is better?
Why is it recommended that technologists write blogs?
Stm32bug [stlink forced update prompt appears in keilmdk, but it cannot be updated]
150 ppt! The most complete "fair perception machine learning and data mining" tutorial, Dr. AIST Toshihiro kamishima, Japan
What are the virtual machine software? What are their respective functions?
Future源碼一觀-JUC系列
Learning video website
Have you entered the workplace since the first 00???
Add IDM to Google browser
JSON string conversion in unity
2006 translation
MySQL maxscale realizes read-write separation