Open bemoregt opened 7 years ago
You must be retraining for less then 5 classes, then this diff should work for you:
diff --git a/train.lua b/train.lua
index 9f43e0b..a21f1d2 100644
--- a/train.lua
+++ b/train.lua
@@ -134,7 +134,7 @@ function Trainer:computeScore(output, target, nCrops)
-- Coputes the top1 and top5 error rate
local batchSize = output:size(1)
- local _ , predictions = output:float():topk(5, 2, true, true) -- descending
+ local _ , predictions = output:float():topk(math.min(5, output:size(2)), 2, true, true) -- descending
-- Find which predictions match the target
local correct = predictions:eq(
Many thanks !
나의 iPhone에서 보냄
You must be retraining for less then 5 classes, then this diff should work for you:
diff --git a/train.lua b/train.lua index 9f43e0b..a21f1d2 100644 --- a/train.lua +++ b/train.lua @@ -134,7 +134,7 @@ function Trainer:computeScore(output, target, nCrops) -- Coputes the top1 and top5 error rate local batchSize = output:size(1)
- local _ , predictions = output:float():topk(5, 2, true, true) -- descending
local _ , predictions = output:float():topk(math.min(5, output:size(2)), 2, true, true) -- descending
-- Find which predictions match the target local correct = predictions:eq( — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I just using 2 classes.
Thanks at any rate.
Hi, @zpao @iassael @maraoz @achao @gfosco
I have met this error:
./train.lua:137: bad argument #1 to 'topk' (k not in range for dimension
What's wrong with me?
Thanks at any rate...