Skip to content

Instantly share code, notes, and snippets.

View MalteGruber's full-sized avatar

Malte Gruber MalteGruber

View GitHub Profile
@MalteGruber
MalteGruber / argparse_starter.py
Created March 28, 2021 13:39
Python Argparse flag without argument
import argparse
parser = argparse.ArgumentParser(description='My Program')
# Flag without arguments, False if not provided
parser.add_argument('--from-script','-s', dest='started_from_script',action='store_true', help='')
args = parser.parse_args()
print(args.started_from_script)
@MalteGruber
MalteGruber / tensorflow_crop.py
Last active May 11, 2020 18:29
Helper code to untangle tf.image.crop_and_resize when performing a simple crop. Not optimized for speed.
"""
Helper code to untangle tf.image.crop_and_resize when performing a simple crop. Not optimized for speed.
Arguments:
tf_img -- Input tensorflow image
output_size -- Output size in pixels (w,h)
crop_yx -- Top left coordinate of crop, (y,x)
crop_size -- Size of area to include in crop (w,h)
Returns: