Effacer les filtres
Effacer les filtres

How to upload groundTruth?

1 vue (au cours des 30 derniers jours)
Thijs Langius
Thijs Langius le 24 Août 2022
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);

Réponses (1)

Saffan
Saffan le 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:

Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by