MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / create_fake_project

Function create_fake_project

examples/utils.py:257–324  ·  view source on GitHub ↗
(path: Path, params: SyntheticProjectParameters)

Source from the content-addressed store, hash-verified

255
256
257def create_fake_project(path: Path, params: SyntheticProjectParameters) -> None:
258 if path.exists():
259 raise ValueError("Cannot create a fake project at an existing path")
260
261 scorer = "synthetic"
262 video_name = "cat"
263 path.mkdir(parents=True, exist_ok=False)
264 config = {
265 "Task": "synthetic",
266 "scorer": scorer,
267 "date": "Nov11",
268 "multianimalproject": params.multianimal,
269 "identity": params.identity,
270 "project_path": str(path / "config.yaml"),
271 "TrainingFraction": [0.8],
272 "iteration": 0,
273 "default_net_type": "resnet_50",
274 "default_augmenter": "default",
275 "default_track_method": "ellipse",
276 "snapshotindex": "all",
277 "batch_size": 8,
278 "pcutoff": 0.6,
279 "video_sets": {
280 str(path / "videos" / video_name): {
281 "crop": (0, params.frame_shape[1], 0, params.frame_shape[0]),
282 },
283 },
284 "start": 0,
285 "stop": 1,
286 "numframes2pick": 10,
287 "dotsize": 4,
288 "alphavalue": 1.0,
289 "colormap": "rainbow",
290 }
291 if not params.multianimal:
292 config["bodyparts"] = params.bodyparts()
293 assert params.num_individuals == 1
294 assert params.num_unique == 0
295 else:
296 config["bodyparts"] = "MULTI!"
297 config["multianimalbodyparts"] = params.bodyparts()
298 config["uniquebodyparts"] = params.unique()
299 config["individuals"] = params.individuals()
300
301 af.write_config(str(path / "config.yaml"), config)
302 image_dir = path / "labeled-data" / video_name
303 image_dir.mkdir(parents=True, exist_ok=False)
304
305 df = gen_fake_data(
306 scorer=scorer,
307 video_name=video_name,
308 params=params,
309 )
310 print("SYNTHETIC DATA:")
311 print(df)
312 print("\n")
313 if not params.multianimal:
314 df.columns = df.columns.droplevel("individuals")

Callers 3

mainFunction · 0.90
mainFunction · 0.90
utils.pyFile · 0.85

Calls 7

gen_fake_dataFunction · 0.85
gen_fake_imageFunction · 0.85
bodypartsMethod · 0.80
uniqueMethod · 0.80
individualsMethod · 0.80
write_configMethod · 0.45

Tested by 2

mainFunction · 0.72
mainFunction · 0.72