MCPcopy Index your code
hub / github.com/CandleLabAI/PCBSegClassNet / get_data

Function get_data

src/data/dataloader.py:176–211  ·  view source on GitHub ↗
(opt)

Source from the content-addressed store, hash-verified

174
175
176def get_data(opt):
177 train_opt = opt["datasets"]["train"]
178 val_opt = opt["datasets"]["val"]
179 num_classes = opt["train"]["num_classes"]
180
181 # train
182 train_images, train_targets = get_paths(train_opt)
183 val_images, val_targets = get_paths(val_opt)
184
185 if train_opt["type"] == "Segmentation":
186 train_data = LoadSegData(train_opt)
187 trainDS = train_data.init(train_images, train_targets)
188
189 elif train_opt["type"] == "Classification":
190 train_data = LoadClassData(train_opt, num_classes)
191 trainDS = train_data.init(train_images, train_targets)
192
193 else:
194 assert (
195 False
196 ), f"Found data type as {train_opt['type']} but it should be one of Segmentation/Classification"
197
198 if val_opt["type"] == "Segmentation":
199 val_data = LoadSegData(val_opt)
200 valDS = val_data.init(val_images, val_targets)
201
202 elif val_opt["type"] == "Classification":
203 val_data = LoadClassData(val_opt, num_classes)
204 valDS = val_data.init(val_images, val_targets)
205
206 else:
207 assert (
208 False
209 ), f"Found data type as {val_opt['type']} but it should be one of Segmentation/Classification"
210
211 return trainDS, valDS

Callers 2

mainFunction · 0.90
mainFunction · 0.90

Calls 4

initMethod · 0.95
get_pathsFunction · 0.85
LoadSegDataClass · 0.85
LoadClassDataClass · 0.85

Tested by

no test coverage detected