Skip to content

Commit

Permalink
implement profile in do_seg
Browse files Browse the repository at this point in the history
  • Loading branch information
dbuscombe-usgs committed Mar 6, 2023
1 parent a412849 commit e5df071
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions doodleverse_utils/prediction_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def est_label_binary(image,Mc,MODEL,TESTTIMEAUG,NCLASSES,TARGET_SIZE,w,h):
est_label = model(tf.expand_dims(image, 0)).logits
else:
est_label = tf.squeeze(model.predict(tf.expand_dims(image, 0), batch_size=1))

except:
if MODEL=='segformer':
est_label = model.predict(tf.expand_dims(image[:,:,0], 0), batch_size=1).logits
Expand Down Expand Up @@ -293,6 +293,8 @@ def do_seg(

if profile=='meta':
WRITE_MODELMETADATA = True
if profile=='full':
WRITE_MODELMETADATA = True

Mc = compile_models(M, MODEL)

Expand Down Expand Up @@ -455,7 +457,7 @@ def do_seg(
if profile !='minimal':
np.savez_compressed(segfile, **metadatadict)

if (profile !='minimal') and (profile !='meta'):
if profile == 'full': #(profile !='minimal') and (profile !='meta'):
#### plot overlay
segfile = segfile.replace("_res.npz", "_overlay.png")

Expand Down Expand Up @@ -489,7 +491,7 @@ def do_seg(
plt.savefig(segfile, dpi=200, bbox_inches="tight")
plt.close("all")

if (profile !='minimal') and (profile !='meta'):
if profile == 'full': #(profile !='minimal') and (profile !='meta'):

#### plot overlay of per-class probabilities
for kclass in range(softmax_scores.shape[-1]):
Expand Down

0 comments on commit e5df071

Please sign in to comment.