(raw_root_path, save_root_path)
| 48 | |
| 49 | # build CycleGAN trainSet A |
| 50 | def buildTrainA(raw_root_path, save_root_path): |
| 51 | files_list = os.listdir(raw_root_path) |
| 52 | if not os.path.exists(save_root_path): |
| 53 | os.makedirs(save_root_path) |
| 54 | start = time.time() |
| 55 | for fileIndex, fileName in enumerate(files_list): |
| 56 | t0 = time.time() |
| 57 | print('Begin {}/{}: {}'.format(fileIndex+1, len(files_list), fileName)) |
| 58 | imageDir = os.path.join(raw_root_path, fileName) |
| 59 | imagePath = os.path.join(imageDir, 'xray1.png') |
| 60 | image = cv2.imread(imagePath, 0) |
| 61 | savePath = os.path.join(save_root_path, '{}.png'.format(fileName)) |
| 62 | cv2.imwrite(savePath, image) |
| 63 | t1 = time.time() |
| 64 | print('End! Case time: {}'.format(t1-t0)) |
| 65 | end = time.time() |
| 66 | print('Finally! Total time of build TrainA: {}'.format(end-start)) |
| 67 | |
| 68 | # build CycleGAN trainSet B |
| 69 | def buildTrainB(raw_root_path, save_root_path): |
nothing calls this directly
no outgoing calls
no test coverage detected