フィルターのクリア

How to upload groundTruth?

1 回表示 (過去 30 日間)
Thijs Langius
Thijs Langius 2022 年 8 月 24 日
回答済み: Saffan 2023 年 9 月 7 日
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);

回答 (1 件)

Saffan
Saffan 2023 年 9 月 7 日
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:

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by