|
@@ -216,7 +216,12 @@ local function create_metric(metric)
|
|
|
local num_a = ba:sum()
|
|
|
local num_b = bb:sum()
|
|
|
local a_and_b = ba:cmul(bb):sum()
|
|
|
- return (a_and_b / (num_a + num_b - a_and_b))
|
|
|
+ local abab = (num_a + num_b - a_and_b)
|
|
|
+ if abab > 0 then
|
|
|
+ return (a_and_b / abab)
|
|
|
+ else
|
|
|
+ return 1
|
|
|
+ end
|
|
|
end}
|
|
|
else
|
|
|
error("unknown metric: " .. metric)
|
|
@@ -615,10 +620,10 @@ local function load_data_from_dir(test_dir)
|
|
|
table.insert(test_x, {y = iproc.crop_mod4(img),
|
|
|
basename = base})
|
|
|
end
|
|
|
- if opt.show_progress then
|
|
|
- xlua.progress(i, #files)
|
|
|
- end
|
|
|
if i % 10 == 0 then
|
|
|
+ if opt.show_progress then
|
|
|
+ xlua.progress(i, #files)
|
|
|
+ end
|
|
|
collectgarbage()
|
|
|
end
|
|
|
end
|
|
@@ -636,10 +641,10 @@ local function load_data_from_file(test_file)
|
|
|
table.insert(test_x, {y = iproc.crop_mod4(img),
|
|
|
basename = base})
|
|
|
end
|
|
|
- if opt.show_progress then
|
|
|
- xlua.progress(i, #files)
|
|
|
- end
|
|
|
if i % 10 == 0 then
|
|
|
+ if opt.show_progress then
|
|
|
+ xlua.progress(i, #files)
|
|
|
+ end
|
|
|
collectgarbage()
|
|
|
end
|
|
|
end
|
|
@@ -694,10 +699,10 @@ local function load_user_data(y_dir, y_file, x_dir, x_file)
|
|
|
x = x,
|
|
|
basename = key})
|
|
|
end
|
|
|
- if opt.show_progress then
|
|
|
- xlua.progress(i, #y_files)
|
|
|
- end
|
|
|
if i % 10 == 0 then
|
|
|
+ if opt.show_progress then
|
|
|
+ xlua.progress(i, #y_files)
|
|
|
+ end
|
|
|
collectgarbage()
|
|
|
end
|
|
|
end
|