Skip to content

Commit

Permalink
add function for creating a multiview dataset and stitching these ima…
Browse files Browse the repository at this point in the history
…ges together
  • Loading branch information
MarijnJABoer committed Jun 27, 2018
1 parent 15a60ed commit f67d4f7
Show file tree
Hide file tree
Showing 8 changed files with 296 additions and 105 deletions.
47 changes: 47 additions & 0 deletions data/badspecimens_multi.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Catalog_number
jtlc000007882
casent0903570
focol2958
casent0916813
focol2797
casent0101417
casent0102532
casent0901925
casent0101879
casent0101951
casent0911777
casent0910170
casent0903586
casent0903589
casent0905327
focol2959
casent0902084
jtlc000002495
casent0132820
casent0101934
casent0916815
casent0916821
casent0911308
casent0901683
casent0912507
casent0178536
focol2208
casent0907373
casent0010821
casent0010882
casent0102292
casent0922207
focol1383
focol1384
casent0902845
casent0907478
castype06976
casent0922570
casent0913604
casent0915417
antweb1038244
casent0137344
casent0912542
casent0906517
inbiocri002280277
casent0913605
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions formicID/AntWeb/json_to_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _filter_json(json_file, quality, multi_only):
scientific_name = row[1]
image_url = {}
if multi_only is True:
if ("d" in row[2] and "h" in row[2] and "p" in row[2]):
if "d" in row[2] and "h" in row[2] and "p" in row[2]:
image_url["d"] = row[2]["d"]["img"][qlty]
image_url["h"] = row[2]["h"]["img"][qlty]
image_url["p"] = row[2]["p"]["img"][qlty]
Expand Down Expand Up @@ -118,7 +118,12 @@ def _filter_json(json_file, quality, multi_only):


def batch_json_to_csv(
csvname, dataset, quality="low", output_dir=None, overwrite=False, multi_only=False
csvname,
dataset,
quality="low",
output_dir=None,
overwrite=False,
multi_only=False,
):
"""Creates a csvfile, from a batch of json files, filling it with all the
relevant information for downloading images and naming the files.
Expand Down
6 changes: 3 additions & 3 deletions formicID/configs/config.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"exp_name": "Multi_test",
"exp_name": "T97_CaAll_QuM_ShAll_AugM_D05_LR0001_E200_I4_def_clean",
"data_set": "top97species_Qmed_def_clean_multi",
"batch_size": 32,
"dropout": 0.5,
"learning_rate": 0.001,
"model": "InceptionResNetV2",
"num_epochs": 5,
"num_epochs": 200,
"optimizer": "Nadam",
"seed": 1,
"test_split": 0.1,
"val_split": 0.2,
"shottype": "head"
"shottype": "stitched"
}
2 changes: 0 additions & 2 deletions formicID/data_loader/data_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,11 @@ def split_in_directory(config, bad=None):
random.shuffle(shuffled)
num1 = round(len(shuffled) * test_split)
num2 = round(len(shuffled) * val_split)
# fmt: off
to_test, to_val, to_train = (
shuffled[:num1],
shuffled[num1:num2],
shuffled[num2:],
)
# fmt: on
for image in os.listdir(os.path.join(input_dir, species)):
if image.endswith(".jpg"):
for img in to_test:
Expand Down
Loading

0 comments on commit f67d4f7

Please sign in to comment.