This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| img_path = outDirPath + 'images/' + imgName | |
| img = cv2.imread(img_path, cv2.IMREAD_COLOR) | |
| '''FIRST VERSION''' | |
| mask = cv2.cvtColor(mask, cv2.COLOR_RGB2GRAY) | |
| dest = cv2.bitwise_and(img, img, mask = mask) | |
| for coordinates in coordinatesList: | |
| coords = coordinates[:len(coordinates)-1] | |
| #ANCIEN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from os import walk | |
| f = [] | |
| for (dirpath, dirnames, filenames) in walk(mypath): | |
| f.extend(filenames) | |
| break |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try: | |
| os.chdir(datasetPath) | |
| zipf = zipfile.ZipFile('./../pascal_voc_dataset.zip', 'a', zipfile.ZIP_DEFLATED) | |
| zipdir('ImageSets/', zipf) | |
| zipdir('JPEGImages/', zipf) | |
| zipdir('SegmentationClass/', zipf) | |
| zipf.close() | |
| os.chdir('../') | |
| print('[INFO] Archive successfully built.') | |
| except: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| base = os.path.basename(imagePath) | |
| fileName = os.path.splitext(base)[0] | |
| os.path.isdir(dataPath) | |
| shutil.copyfile(imagePath, newImgPath) | |
| os.makedirs(datasetPath) | |
| if os.path.isdir(datasetPath): | |
| shutil.rmtree(datasetPath, ignore_errors=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if __name__ == "__main__": | |
| with open('somefile.txt', 'a') as the_file: | |
| the_file.write('Hello\n') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| def manage_args(): | |
| parser = argparse.ArgumentParser() | |
| #positional args | |
| parser.add_argument("input_img", help="input image which mask has been computed", type=str) | |
| parser.add_argument("input_mask", help="semantic segmentation mask computed from the input image", type=str) | |
| parser.add_argument("output_dir", help="output directory where the result will be saved", type=str) | |
| ''' |
NewerOlder