ラベル付けされたtableをカウントする方法について
Mostrar comentarios más antiguos
こんにちは。
ディープラーニングで学習するためのデータにラベル付けをおこないました。
そこで、各カテゴリごとのラベルの数を数えたいのですが方法が思いつきません。カテゴリは22種類あり、ラベル付けされているものは座標と幅、高さが記入されており、ラベル付けしてないものは空白のままです。tableの列方向のラベルの付いている数を知りたいです。
1万枚以上あるため、手動で数えるのは大変なのでなるべくプログラミングで実行したいです。
アイディア、アドバイス等ありましたら宜しくお願い致します。
5 comentarios
源樹 上林
el 21 de Dic. de 2020
データはおおよそこんなイメージですか?
label = {'hoge';'hoge'; '';'hoge'};
zahyo = [ 1,2; 3,4;5,6; 7,8];
width = [ 1; 2; 3; 4];
height = [ 5; 6; 7; 8];
T = table(label, zahyo, width, height);
そして
T.label
のなかで、 '' と一致しない数の合計を数えたい。
という理解で合っていますか?
HY
el 23 de Dic. de 2020
源樹 上林
el 23 de Dic. de 2020
例の提示ありがとうございます。
forで回せば何でも解決でき…1万7千枚はあまり回したくはないですね。遅くなりそうな気がする。
nameImg = { '1.jpg', '2.jpg', '3.jpg' }';
label1 = {[2 2 22 33], [0], [5 6 90 87]}';
label2 = {[0], [9 8 30 28], [0]}';
T = table( label1, label2, 'RowNames', nameImg)
% ゼロ以外のインデックス
i = not( cellfun( @(x) isequal(x,0), T.label1 ) );
% ゼロ以外が取り出せていることを確認
T.label1(i)
% ゼロ以外の数
sum(i)
こういう感じですか?あとはこれを22回繰り返すとか。
ちょっとすっきりしない。
HY
el 23 de Dic. de 2020
HY
el 24 de Dic. de 2020
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre 製品のインストール en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!