Skip to content

Commit

Permalink
Skipping images processed before
Browse files Browse the repository at this point in the history
  • Loading branch information
jccaicedo committed Sep 13, 2018
1 parent d34dd91 commit 5575e61
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions unet4nuclei/batch_prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,18 @@


# Check that images have not been processed before
print("Verifying image list")
image_list["Done"] = False
for k,r in image_list.iterrows():
img_name = image_list.loc[k,"DNA"]
outfile = output_dir + img_name.replace(IMG_EXT, ".csv")
if os.path.isfile(outfile):
image_list.loc[k,"Done"] = True

print(image_list.shape)
print("Total images:",image_list.shape[0])
image_list = image_list[~image_list["Done"]]
print(image_list.shape)
print("Pending processing:", image_list.shape[0])

sys.exit()

i = 0
while i < total_num_images:
Expand All @@ -103,17 +103,11 @@
# Check that images exist
missing = [k for k in range(len(image_names)) if not os.path.isfile(image_names[k])]

# Check that images have not been processed
outfiles = [b.replace(input_dir, output_dir).replace(IMG_EXT,".csv") for b in image_names]
already_done = [k for k in range(len(outfiles)) if os.path.isfile(outfiles[k])]

# Filter images missing and done
# Filter images missing
good_to_go = []
for j in range(len(batch)):
if j in missing:
print("Image missing:", batch[j])
elif j in already_done:
print("Already done:", batch[j])
else:
good_to_go.append(j)

Expand Down

0 comments on commit 5575e61

Please sign in to comment.