Giter VIP home page Giter VIP logo

Comments (5)

Semayuki avatar Semayuki commented on August 25, 2024 1

ご回答いただきありがとうございます。

とてもわかりやすいです。
しかし、私が知りたいのは、[:,:4],[:,4]の表記の意味です。
ご回答いただけますと幸いです。

よろしくお願い致します。

from pytorch_advanced.

Semayuki avatar Semayuki commented on August 25, 2024 1

大変よくわかりました。
ありがとうございます。

from pytorch_advanced.

YutaroOgawa avatar YutaroOgawa commented on August 25, 2024

@Semayuki さま

ご質問いただき、ありがとうございます。

p. 74の

img_transformed, boxes, labels = transform(img, phase, anno_list[:, :4], anno_list[:, 4])

の部分を指していると解釈しました。

ここの変数anno_listは、p. 73 の下部で

# 2. アノテーションをリストに
transform_anno = Anno_xml2list(voc_classes)
anno_list = transform_anno(train_anno_list[0], width, height)

で定義されています。
transform_annoは、クラスAnno_xml2listのオブジェクトです。

よって、anno_listはAnno_xml2listのreturnしている変数になります。

そして、p. 69にて、
class Anno_xml2list()を定義しており、
このクラスは、1枚の画像に対する「XML形式のアノテーションデータ」を、
画像サイズで規格化してからリスト形式に変換しており、

return は [xmin, ymin, xmax, ymax, label_ind],

となっています。

そのため、p.73の**部分

anno_list[:, :4] はアノテーションデータのBBoxの座標情報を示し、anno_list[:,4] は物体のクラス名に対応したインデックスの情報です。

という記載の通り、変数anno_listの中身は [xmin, ymin, xmax, ymax, label_ind],
になります。

どうぞ宜しくお願い致します。

from pytorch_advanced.

YutaroOgawa avatar YutaroOgawa commented on August 25, 2024

@Semayuki さま

p. 71の**部分に

transform_anno = Anno_xml2list(voc_classes)


# アノテーションをリストで表示
transform_anno(val_anno_list[ind], width, height)

のあとに、

array([[ 0.09 , 0.03058104, 0.998 , 1.01529052, 18. ],
[ 0.122 , 0.57798165, 0.164 , 0.74006116, 14. ]])

と、anno_listの中身の例を記載しています。

この通り、anno_listは1行N列(Nはミニバッチサイズなど、一度に処理する画像枚数に対応)となります。
この1行が入っていて、その中に [xmin, ymin, xmax, ymax, label_ind]が、入っているのが、今回疑問に思われた原因かもしれません。

そのため、[:,:4]の表記の、最初の:は1行目を表しているだけで、[0,:4]でも動作する(と思います)。

そして、Pythonのスライス機能で、アノテーションデータのxmin, ymin, xmax, ymaxを取得しているのが、
,:4] になります。

[:,4]も同様で、4つ目のインデックスのlabel_indを取得しています。

だったら、1行N列にしなければ良いのではと思うところであり、私もパッとはその通りだと思います

ですが、プログラム全体と参考に使用した対象のGitHubから持ってきた関数などとの整合性を見て、
ここをN列でなく、1行N列のarrayにしている理由を確かめないといけないので、その点はすぐに回答ができず、大変申し訳ございません。

どうぞよろしくお願い致します。

from pytorch_advanced.

YutaroOgawa avatar YutaroOgawa commented on August 25, 2024

@Semayuki さま

限られた範囲での回答となり、大変申し訳ございませんが、誠にありがとうございます。

from pytorch_advanced.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.