Apply landmark to MoViNet

オープン
#13,569 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python, tensorflow

調査の方向性

build_classifier の extract_video_features から開始し、endpoints['head'] にアクセスする前に backbone(x, training=False) が返すものを確認します。その戻り値の型と形状を、その後の squeeze および pooling の処理と比較します。次に、動画入力とランドマーク入力を使用して model.fit で 2 入力モデルを検証し、トレーニングが実行されて num_classes 用の出力が生成されることによって完了を確認します。

索引モデルが issue の本文から書いたものです。

説明

type:support

def build_classifier(batch_size, num_frames, backbone, resolution, num_classes):
# --- Video input ---
video_input = layers.Input(shape=(num_frames, resolution, resolution, 3), batch_size=batch_size, name='video_input')

# Feature extraction from MoViNet backbone
def extract_video_features(x):
    endpoints = backbone(x, training=False)
    x = endpoints['head'] 
    x = tf.squeeze(x, axis=[2, 3]) 
    x = tf.keras.layers.GlobalAveragePooling1D()(x)
    return x

video_features = layers.Lambda(
    extract_video_features,
    output_shape=(480,),
    name="video_features"
)(video_input)

# --- Landmark input ---
landmark_input = layers.Input(shape=(num_frames, 234), batch_size=batch_size, name='landmark_input')
landmark_features = layers.Bidirectional(layers.LSTM(128, return_sequences=False))(landmark_input)
landmark_features = layers.Dense(128, activation='relu')(landmark_features)

# --- Fusion ---
merged = layers.Concatenate()([video_features, landmark_features])  # shape: (B, 608)
x = layers.Dense(256, activation='relu')(merged)
x = layers.Dropout(0.3)(x)
outputs = layers.Dense(num_classes, activation='softmax')(x)

model = tf.keras.Model(inputs=[video_input, landmark_input], outputs=outputs)
return model

I build this model but when I run model.fit() it shows in extract_video_features(x)
6 def extract_video_features(x):
7 endpoints = backbone(x, training=False)
----> 8 x = endpoints['head'] # shape: (B, T, 1, 1, C)
9 x = tf.squeeze(x, axis=[2, 3]) # shape: (B, T, C)
10 x = tf.keras.layers.GlobalAveragePooling1D()(x) # shape: (B, C)

TypeError: Exception encountered when calling Lambda.call().

tuple indices must be integers or slices, not str

Arguments received by Lambda.call():
• inputs=tf.Tensor(shape=(None, 50, 224, 224, 3), dtype=float32)
• mask=None
• training=True.

How can I fix this or any other ways to apply landmarks?

主要言語
Python
スター
77.6k
フォーク
44.8k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

tensorflow/models のほかの issue

tensorflow/models の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。