MCPcopy Create free account
hub / github.com/Hironsan/BossSensor / traverse_dir

Function traverse_dir

boss_input.py:39–51  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

37images = []
38labels = []
39def traverse_dir(path):
40 for file_or_dir in os.listdir(path):
41 abs_path = os.path.abspath(os.path.join(path, file_or_dir))
42 print(abs_path)
43 if os.path.isdir(abs_path): # dir
44 traverse_dir(abs_path)
45 else: # file
46 if file_or_dir.endswith('.jpg'):
47 image = read_image(abs_path)
48 images.append(image)
49 labels.append(path)
50
51 return images, labels
52
53
54def read_image(file_path):

Callers 1

extract_dataFunction · 0.85

Calls 1

read_imageFunction · 0.85

Tested by

no test coverage detected