Skip to content

Commit

Permalink
update keras verbose level
Browse files Browse the repository at this point in the history
  • Loading branch information
m35988ys authored and m35988ys committed Nov 12, 2023
1 parent 324470b commit dd681b7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/spectra_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def spectra_sym_gen(eobj, x, y, adv_value=1, testgen_factor=.2, testgen_size=0):
else:
np.put(t, L, adv_value)
x_flag.flat[L]=True #np.put(x, L, True)
new_y=np.argsort(model.predict(sbfl_preprocess(eobj, np.array([t]))))[0][-eobj.top_classes:]
new_y=np.argsort(model.predict(sbfl_preprocess(eobj, np.array([t])), verbose=10))[0][-eobj.top_classes:]
is_adv=(len(np.intersect1d(y, new_y))==0)

if is_adv:
Expand All @@ -54,7 +54,7 @@ def spectra_sym_gen(eobj, x, y, adv_value=1, testgen_factor=.2, testgen_size=0):
else:
np.put(t, L, adv_value)
x_flag.flat[L]=True #np.put(x, L, True)
new_y=np.argsort(model.predict(sbfl_preprocess(eobj, np.array([t]))))[0][-eobj.top_classes:]
new_y=np.argsort(model.predict(sbfl_preprocess(eobj, np.array([t])), verbose=10))[0][-eobj.top_classes:]
#is_adv=(len(np.intersect1d(y, new_y))==0)
#ite-=0.01
#L2=L0[0:int(ite/testgen_factor*portion)]
Expand Down Expand Up @@ -85,7 +85,7 @@ def spectra_sym_gen(eobj, x, y, adv_value=1, testgen_factor=.2, testgen_size=0):
else:
np.put(t, L, adv_value)
x_flag.flat[L]=True #np.put(x, L, True)
new_y=np.argsort(model.predict(sbfl_preprocess(eobj, np.array([t]))))[0][-eobj.top_classes:]
new_y=np.argsort(model.predict(sbfl_preprocess(eobj, np.array([t])), verbose=10))[0][-eobj.top_classes:]
#t2=x.copy()
#ite=(ite+1)/2
##ite+=0.01
Expand Down
2 changes: 1 addition & 1 deletion src/to_explain.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def to_explain(eobj):

for i in range(0, len(eobj.inputs)):
x=eobj.inputs[i]
res=model.predict(sbfl_preprocess(eobj, np.array([x])))
res=model.predict(sbfl_preprocess(eobj, np.array([x])), verbose=10)
y=np.argsort(res)[0][-eobj.top_classes:]

print ('\n[Input {2}: {0} / Output Label (to Explain): {1}]'.format(eobj.fnames[i], y, i))
Expand Down
2 changes: 1 addition & 1 deletion src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def top_plot(sbfl_element, ind, di, metric='', eobj=None, bg=128, online=False,
count+=1
if count%base==0:
save_an_image(im_o, '{1}-{0}'.format(int(count/base), metric), di)
res=sbfl_element.model.predict(sbfl_preprocess(eobj, np.array([im_o])))
res=sbfl_element.model.predict(sbfl_preprocess(eobj, np.array([im_o])), verbose=10)
y=np.argsort(res)[0][-eobj.top_classes:]
#print (int(count/base), '>>>', y, sbfl_element.y, y==sbfl_element.y)
if y==sbfl_element.y and not found_exp:
Expand Down

0 comments on commit dd681b7

Please sign in to comment.