alkzar90 commited on
Commit
52706f7
1 Parent(s): e54d51d

Add masks_dir

Browse files
Files changed (1) hide show
  1. cell_benchmark.py +7 -6
cell_benchmark.py CHANGED
@@ -42,12 +42,13 @@ class Cellsegmentation(datasets.GeneratorBasedBuilder):
42
 
43
  def _split_generators(self, dl_manager):
44
  data_files = dl_manager.download_and_extract(_SPLIT_URLS)
 
45
  splits = [
46
  datasets.SplitGenerator(
47
  name=datasets.Split.TRAIN,
48
  gen_kwargs={
49
  "files" : dl_manager.iter_files([data_files["train"]]),
50
- "masks": data_files["masks"],
51
  "split": "training",
52
  },
53
  ),
@@ -55,7 +56,7 @@ class Cellsegmentation(datasets.GeneratorBasedBuilder):
55
  name=datasets.Split.VALIDATION,
56
  gen_kwargs={
57
  "files" : dl_manager.iter_files([data_files["val"]]),
58
- "masks": data_files["masks"],
59
  "split": "validation",
60
  },
61
  ),
@@ -63,7 +64,7 @@ class Cellsegmentation(datasets.GeneratorBasedBuilder):
63
  name=datasets.Split.TEST,
64
  gen_kwargs={
65
  "files" : dl_manager.iter_files([data_files["test"]]),
66
- "masks": data_files["masks"],
67
  "split": "test",
68
  }
69
  )
@@ -71,13 +72,13 @@ class Cellsegmentation(datasets.GeneratorBasedBuilder):
71
  return splits
72
 
73
 
74
- def _generate_examples(self, files, masks, split):
75
- mask_path = os.path.basename(masks)
76
  for i, path in enumerate(files):
77
  file_name = os.path.basename(path)
78
  yield i, {
79
  "image": path,
80
- "masks": mask_path + "mask_" + file_name.replace("jpg", "png"),
81
  "path": path,
82
  }
83
 
 
42
 
43
  def _split_generators(self, dl_manager):
44
  data_files = dl_manager.download_and_extract(_SPLIT_URLS)
45
+ masks_dir = os.path.basename(data_files["masks"])
46
  splits = [
47
  datasets.SplitGenerator(
48
  name=datasets.Split.TRAIN,
49
  gen_kwargs={
50
  "files" : dl_manager.iter_files([data_files["train"]]),
51
+ "masks": masks_dir,
52
  "split": "training",
53
  },
54
  ),
 
56
  name=datasets.Split.VALIDATION,
57
  gen_kwargs={
58
  "files" : dl_manager.iter_files([data_files["val"]]),
59
+ "masks": masks_dir,
60
  "split": "validation",
61
  },
62
  ),
 
64
  name=datasets.Split.TEST,
65
  gen_kwargs={
66
  "files" : dl_manager.iter_files([data_files["test"]]),
67
+ "masks": masks_dir,
68
  "split": "test",
69
  }
70
  )
 
72
  return splits
73
 
74
 
75
+ def _generate_examples(self, files, masks_dir, split):
76
+ masks_dir = masks_dir
77
  for i, path in enumerate(files):
78
  file_name = os.path.basename(path)
79
  yield i, {
80
  "image": path,
81
+ "masks": mask_dir + "mask_" + file_name.replace("jpg", "png"),
82
  "path": path,
83
  }
84