Filter löschen
Filter löschen

How to upload groundTruth?

1 Ansicht (letzte 30 Tage)
Thijs Langius
Thijs Langius am 24 Aug. 2022
Beantwortet: Saffan am 7 Sep. 2023
I have a question regarding my image recognition project.
I downloaded labeled images. I now have a filemap containg .jpg (images) and .txt files (coordinates of the box).
Example 123_456.jpg, and 123_456.txt.
Txt files contain for ex.:
0 0.578964870010237 0.553121683650408 0.130052151238592 0.24380704041721.
Furthermore I have a structure containing the following info:
Name, Folder, Date, Bytses, Isdir and datenum
How can I merge all coordinates and all names into one struct/matrix?
I want to make a groundTruth with the following function:
gTruth = groundTruth(dataSource,labelDefs,labelData);

Antworten (1)

Saffan
Saffan am 7 Sep. 2023
Hi Thijs,
You can use “readmatrix method to extract the coordinates from the text files and “fileparts” method to extract the name of the images and store them in a structure. Here is an example code snippet:
for i = 1:numberOfFiles
% Read the .txt file and extract the coordinates
coordinates = readmatrix(txtFilePath(i));
% Extract the image name from the file path
[~, imageName, ~] = fileparts(imageFilePath(i));
% Append the name and coordinates to the mergedData struct
mergedData(end+1).Name = imageName;
mergedData(end).Coordinates = coordinates;
end
Please refer this for more information:

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by