abdulfatir / abdulfatir/prototypical-networks-tensorflow

I have a problem about different class querry.

未關閉
#4 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Jupyter Notebook
星號
133
分支
45
PR 合併指標
30 天內沒有已合併 PR

描述

Hi, I'm studying your code, and I notice that during the test process, the proto net is very good at recognizing a new class(which is just learned) from all the classes in training set. However, when I need it to recognize the just learned class from other unseen classes, it performs very badly.

``` python
print('Testing NEGATIVE...')
avg_acc = 0.
for epi in range(n_test_episodes):
epi_classes = np.random.permutation(n_test_classes)[:n_test_way+1]

wrong = epi_classes[-1] ### I changed here, to generate a third new class for test querry, it's totally unseen before

support = np.zeros([n_test_way, n_test_shot, im_height, im_width], dtype=np.float32)
query = np.zeros([n_test_way, n_test_query, im_height, im_width], dtype=np.float32)
for i, epi_cls in enumerate(epi_classes[:-1]):
selected = np.random.permutation(n_examples)[:n_test_shot + n_test_query]
support[i] = test_dataset[epi_cls, selected[:n_test_shot]]
query[i] = np.concatenate((test_dataset[wrong, selected[n_test_shot:-10]], test_dataset[epi_cls,selected[-10:]]))
support = np.expand_dims(support, axis=-1)
query = np.expand_dims(query, axis=-1)
labels = np.tile(np.arange(n_test_way)[:, np.newaxis], (1, n_test_query)).astype(np.uint8)
ls, ac = sess.run([ce_loss, acc], feed_dict={x: support, q: query, y:labels})
avg_acc += ac
if (epi+1) % 50 == 0:
print('[test episode {}/{}] => loss: {:.5f}, acc: {:.5f}'.format(epi+1, n_test_episodes, ls, ac))
avg_acc /= n_test_episodes
print('Average Test Accuracy: {:.5f}'.format(avg_acc))
```
The performance is :

Testing NEGATIVE...
Average Test Accuracy: 0.54737

-----

Please correct me if I understand it wrong.
Looking forward to your reply, and thank you for your help in advance.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。