# How do I obtain the distance from the bounding boxes in YOLO v2/v3 in MATLAB?

45 Ansichten (letzte 30 Tage)
Youssef hany am 6 Aug. 2021
Kommentiert: farah bouzidi am 1 Jul. 2022
Hello,
I currently trained my dataset on both YOLO v2 and v3; however, I am not sure on how to obtain the distance using the corners of the bounding boxes?
Is there a specific function or loop that I need to use?
I appreciate all the feedback.
##### 1 KommentarKeine anzeigenKeine ausblenden
farah bouzidi am 1 Jul. 2022

Melden Sie sich an, um zu kommentieren.

### Antworten (2)

Vineet Joshi am 28 Okt. 2021
Hi
The standard bounding box format in YOLOv2/v3 is a four dimentional vector described as follows.
[x y width height]
Using this you can find the coordinate of the four corners of the bounding box.
Once you have all four coordinates you can use the pdist function to find the distances.
The following resources will help.
Hope this helps
Thanks
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

yanqi liu am 28 Okt. 2021
sir, may be use the dice to compute Sørensen-Dice similarity coefficient for image segmentation
clc; clear all; close all;
region1 = [350 700 425 120]; % [x y w h] format
BW1 = false(size(RGB,1),size(RGB,2));
BW1(region1(2):region1(2)+region1(4),region1(1):region1(1)+region1(3)) = true;
region2 = [800 1124 120 230];
BW2 = false(size(RGB,1),size(RGB,2));
BW2(region2(2):region2(2)+region2(4),region2(1):region2(1)+region2(3)) = true;
region3 = [20 1320 480 200; 1010 290 180 240];
BW3 = false(size(RGB,1),size(RGB,2));
BW3(region3(1,2):region3(1,2)+region3(1,4),region3(1,1):region3(1,1)+region3(1,3)) = true;
BW3(region3(2,2):region3(2,2)+region3(2,4),region3(2,1):region3(2,1)+region3(2,3)) = true;
imshow(RGB)
hold on
visboundaries(BW1,'Color','r');
visboundaries(BW2,'Color','g');
visboundaries(BW3,'Color','b');
title('Seed Regions')
similarity = dice(L, L_groundTruth)
similarity = 3×1
0.9396 0.7247 0.9139
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Find more on Computer Vision Toolbox in Help Center and File Exchange

R2020a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by