フィルターのクリア

For object detection, the ground truth bounding boxes are imported as text instead of array from an excel or text file.

2 ビュー (過去 30 日間)
For deep learning based object detection, I have stored the ground truth in an excel (or txt) file. The file names of images are stored in one column and the bounding boxes in the format [x1,y1,width1,height1;....] for each image are stored in another column. When read using readtable function, the bounding boxes are also read as text. How should these be read as Mx4 arrays?
  1 件のコメント
Walter Roberson
Walter Roberson 2020 年 7 月 25 日
Is it correct that the [ and ] and comma and semi-colon are all part of the format?

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 7 月 25 日
filename = 'AppropriateName.txt';
S = fileread(filename);
info = regexp(S, '(?<name>\S+')\s+\[(?<bb>[^]]+)\]', 'names');
bboxes = cellfun(@(s) reshape(str2double(s),4,[]).', regexp({info.bb}, '[,;]', 'split'),'uniform', 0);

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by