当前位置:网站首页>[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
边栏推荐
- Constantly changing harmonyos custom JS components during the Spring Festival - Smart Koi
- Setting methods, usage methods and common usage scenarios of environment variables in postman
- Explain AI accelerator in detail: why is this the golden age of AI accelerator?
- This function has none of DETERMINISTIC, NO SQL..... (you *might* want to use the less safe log_bin_t
- CUDA basic knowledge
- warning: LF will be replaced by CRLF in XXXXXX
- what does ctrl + d do?
- Zigzag scan
- [source code analysis] model parallel distributed training Megatron (5) -- pipestream flush
- 智慧地铁| 云计算为城市地铁交通注入智慧
猜你喜欢

1day vulnerability pushback skills practice (3)
![[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush](/img/94/2bdc31ec05595dbbc8a7a8d6b22252.jpg)
[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush

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

AAAI2022 | Word Embeddings via Causal Inference: Gender Bias Reducing and Semantic Information Preserving

What kind of experience is it when the Institute earns 20000 yuan a month!

Objective-C description method and type method
![Stm32bug [the project references devices, files or libraries that are not installed appear in keilmdk]](/img/0d/7a8370d153a8479b706377c3487220.jpg)
Stm32bug [the project references devices, files or libraries that are not installed appear in keilmdk]

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提权-离线解密

Package details_ Four access control characters_ Two details of protected
随机推荐
[development team follows] API specification
SQL statement strengthening exercise (MySQL 8.0 as an example)
Future源碼一觀-JUC系列
1day vulnerability pushback skills practice (3)
Recursive structure
渗透实战-SQLServer提权
Dare to climb here, you're not far from prison, reptile reverse actual combat case
Jenkins configures IP address access
[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush
MySQL data query optimization -- data structure of index
2022 registration examination for safety production management personnel of fireworks and firecracker production units and examination skills for safety production management personnel of fireworks an
Jenkins continuous integration environment construction V (Jenkins common construction triggers)
Rhcsa day 2
Webhook triggers Jenkins for sonar detection
[Valentine's Day confession code] - Valentine's Day is approaching, and more than 10 romantic love effects are given to the one you love
PID of sunflower classic
(column 23) typical C language problem: find the minimum common multiple and maximum common divisor of two numbers. (two solutions)
Third party login initial version
Setting methods, usage methods and common usage scenarios of environment variables in postman
How to use websocket to realize simple chat function in C #