Skip to content

Commit

Permalink
More bug corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
tabacof committed Jun 5, 2015
1 parent 8490040 commit eb609b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions adversarial.lua
Expand Up @@ -181,20 +181,22 @@ local lbfgsb_w = disturb_x:float()
print("Finding starting point")
local C_init = 0.01
local tol = C_init/10.0
--The initial C must be high enough so that the adversarial search will fail
repeat
print("Trying C = ", C_init)
C = C_init
lb.eval(lbfgsb_function_gradient, lbfgsb_w, lbfgsb_max_iter)
prob, idx = predict()
local prob, idx = predict()
local pred_init = idx:squeeze()
print("Prediction: #" .. pred_init, label[pred_init])
C_init = C_init*10.0
until idx:squeeze() ~= original_target
until pred_init == original_target
C_init = C_init/10.0
local C_min, C_max = 0, C_init
local reps = 0
local tol = C_init/10.0
while C_max - C_min > tol do
print("Reps: " .. reps .. " C min: " .. C_min .. " C max: " .. C_max)
Expand All @@ -207,7 +209,8 @@ while C_max - C_min > tol do
lb.eval(lbfgsb_function_gradient, lbfgsb_w, lbfgsb_max_iter)
local prob, idx = predict()
local pred_mid = idx:squeeze()
print("Prediction: #" .. pred_mid, label[pred_mid])
if not warm_start then
lbfgsb_w:zero()
end
Expand Down
4 changes: 2 additions & 2 deletions overfeat.sh
Expand Up @@ -5,9 +5,9 @@ mkdir ~/overfeat_results/
## now loop through the above array
for class in "${arr[@]}"
do
for i in `seq 1 5`;
for i in {1..5}
do
for j in `seq 1 5`;
for j in {1..5}
do
th adversarial.lua -cuda -i images/$class/example$i.jpg -seed $j -mc -gpu $1 $2
done
Expand Down

0 comments on commit eb609b4

Please sign in to comment.