(path)
| 37 | images = [] |
| 38 | labels = [] |
| 39 | def 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 | |
| 54 | def read_image(file_path): |
no test coverage detected