From 7771d73de2baa309dde671e5c537e6e17f11cc86 Mon Sep 17 00:00:00 2001 From: AK391 <81195143+AK391@users.noreply.github.com> Date: Tue, 22 Jun 2021 17:39:21 -0400 Subject: [PATCH 01/19] gradio demo --- gradio/demo.py | 259 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 gradio/demo.py diff --git a/gradio/demo.py b/gradio/demo.py new file mode 100644 index 0000000..bd5394d --- /dev/null +++ b/gradio/demo.py @@ -0,0 +1,259 @@ +import collections +import os +import tempfile + +from matplotlib import gridspec +from matplotlib import pyplot as plt +import numpy as np +from PIL import Image +import urllib + +import tensorflow as tf +import gradio as gr + +from google.colab import files +from subprocess import call +import sys + +DatasetInfo = collections.namedtuple( + 'DatasetInfo', + 'num_classes, label_divisor, thing_list, colormap, class_names') + + +def _cityscapes_label_colormap(): + """Creates a label colormap used in CITYSCAPES segmentation benchmark. + + See more about CITYSCAPES dataset at https://www.cityscapes-dataset.com/ + M. Cordts, et al. "The Cityscapes Dataset for Semantic Urban Scene Understanding." CVPR. 2016. + + Returns: + A 2-D numpy array with each row being mapped RGB color (in uint8 range). + """ + colormap = np.zeros((256, 3), dtype=np.uint8) + colormap[0] = [128, 64, 128] + colormap[1] = [244, 35, 232] + colormap[2] = [70, 70, 70] + colormap[3] = [102, 102, 156] + colormap[4] = [190, 153, 153] + colormap[5] = [153, 153, 153] + colormap[6] = [250, 170, 30] + colormap[7] = [220, 220, 0] + colormap[8] = [107, 142, 35] + colormap[9] = [152, 251, 152] + colormap[10] = [70, 130, 180] + colormap[11] = [220, 20, 60] + colormap[12] = [255, 0, 0] + colormap[13] = [0, 0, 142] + colormap[14] = [0, 0, 70] + colormap[15] = [0, 60, 100] + colormap[16] = [0, 80, 100] + colormap[17] = [0, 0, 230] + colormap[18] = [119, 11, 32] + return colormap + + +def _cityscapes_class_names(): + return ('road', 'sidewalk', 'building', 'wall', 'fence', 'pole', + 'traffic light', 'traffic sign', 'vegetation', 'terrain', 'sky', + 'person', 'rider', 'car', 'truck', 'bus', 'train', 'motorcycle', + 'bicycle') + + +def cityscapes_dataset_information(): + return DatasetInfo( + num_classes=19, + label_divisor=1000, + thing_list=tuple(range(11, 19)), + colormap=_cityscapes_label_colormap(), + class_names=_cityscapes_class_names()) + + +def perturb_color(color, noise, used_colors, max_trials=50, random_state=None): + """Pertrubs the color with some noise. + + If `used_colors` is not None, we will return the color that has + not appeared before in it. + + Args: + color: A numpy array with three elements [R, G, B]. + noise: Integer, specifying the amount of perturbing noise (in uint8 range). + used_colors: A set, used to keep track of used colors. + max_trials: An integer, maximum trials to generate random color. + random_state: An optional np.random.RandomState. If passed, will be used to + generate random numbers. + + Returns: + A perturbed color that has not appeared in used_colors. + """ + if random_state is None: + random_state = np.random + + for _ in range(max_trials): + random_color = color + random_state.randint( + low=-noise, high=noise + 1, size=3) + random_color = np.clip(random_color, 0, 255) + + if tuple(random_color) not in used_colors: + used_colors.add(tuple(random_color)) + return random_color + + print('Max trial reached and duplicate color will be used. Please consider ' + 'increase noise in `perturb_color()`.') + return random_color + + +def color_panoptic_map(panoptic_prediction, dataset_info, perturb_noise): + """Helper method to colorize output panoptic map. + + Args: + panoptic_prediction: A 2D numpy array, panoptic prediction from deeplab + model. + dataset_info: A DatasetInfo object, dataset associated to the model. + perturb_noise: Integer, the amount of noise (in uint8 range) added to each + instance of the same semantic class. + + Returns: + colored_panoptic_map: A 3D numpy array with last dimension of 3, colored + panoptic prediction map. + used_colors: A dictionary mapping semantic_ids to a set of colors used + in `colored_panoptic_map`. + """ + if panoptic_prediction.ndim != 2: + raise ValueError('Expect 2-D panoptic prediction. Got {}'.format( + panoptic_prediction.shape)) + + semantic_map = panoptic_prediction // dataset_info.label_divisor + instance_map = panoptic_prediction % dataset_info.label_divisor + height, width = panoptic_prediction.shape + colored_panoptic_map = np.zeros((height, width, 3), dtype=np.uint8) + + used_colors = collections.defaultdict(set) + # Use a fixed seed to reproduce the same visualization. + random_state = np.random.RandomState(0) + + unique_semantic_ids = np.unique(semantic_map) + for semantic_id in unique_semantic_ids: + semantic_mask = semantic_map == semantic_id + if semantic_id in dataset_info.thing_list: + # For `thing` class, we will add a small amount of random noise to its + # correspondingly predefined semantic segmentation colormap. + unique_instance_ids = np.unique(instance_map[semantic_mask]) + for instance_id in unique_instance_ids: + instance_mask = np.logical_and(semantic_mask, + instance_map == instance_id) + random_color = perturb_color( + dataset_info.colormap[semantic_id], + perturb_noise, + used_colors[semantic_id], + random_state=random_state) + colored_panoptic_map[instance_mask] = random_color + else: + # For `stuff` class, we use the defined semantic color. + colored_panoptic_map[semantic_mask] = dataset_info.colormap[semantic_id] + used_colors[semantic_id].add(tuple(dataset_info.colormap[semantic_id])) + return colored_panoptic_map, used_colors + + +def vis_segmentation(image, + panoptic_prediction, + dataset_info, + perturb_noise=60): + """Visualizes input image, segmentation map and overlay view.""" + plt.figure(figsize=(30, 20)) + grid_spec = gridspec.GridSpec(2, 2) + + ax = plt.subplot(grid_spec[0]) + plt.imshow(image) + plt.axis('off') + ax.set_title('input image', fontsize=20) + + ax = plt.subplot(grid_spec[1]) + panoptic_map, used_colors = color_panoptic_map(panoptic_prediction, + dataset_info, perturb_noise) + plt.imshow(panoptic_map) + plt.axis('off') + ax.set_title('panoptic map', fontsize=20) + + ax = plt.subplot(grid_spec[2]) + plt.imshow(image) + plt.imshow(panoptic_map, alpha=0.7) + plt.axis('off') + ax.set_title('panoptic overlay', fontsize=20) + + ax = plt.subplot(grid_spec[3]) + max_num_instances = max(len(color) for color in used_colors.values()) + # RGBA image as legend. + legend = np.zeros((len(used_colors), max_num_instances, 4), dtype=np.uint8) + class_names = [] + for i, semantic_id in enumerate(sorted(used_colors)): + legend[i, :len(used_colors[semantic_id]), :3] = np.array( + list(used_colors[semantic_id])) + legend[i, :len(used_colors[semantic_id]), 3] = 255 + if semantic_id < dataset_info.num_classes: + class_names.append(dataset_info.class_names[semantic_id]) + else: + class_names.append('ignore') + + plt.imshow(legend, interpolation='nearest') + ax.yaxis.tick_left() + plt.yticks(range(len(legend)), class_names, fontsize=15) + plt.xticks([], []) + ax.tick_params(width=0.0, grid_linewidth=0.0) + plt.grid('off') +# plt.show() + return plt + +def run_cmd(command): + try: + print(command) + call(command, shell=True) + except KeyboardInterrupt: + print("Process interrupted") + sys.exit(1) +MODEL_NAME = 'max_deeplab_l_backbone_os16_axial_deeplab_cityscapes_trainfine_saved_model' + + +_MODELS = ('resnet50_os32_panoptic_deeplab_cityscapes_crowd_trainfine_saved_model', + 'resnet50_beta_os32_panoptic_deeplab_cityscapes_trainfine_saved_model', + 'wide_resnet41_os16_panoptic_deeplab_cityscapes_trainfine_saved_model', + 'swidernet_sac_1_1_1_os16_panoptic_deeplab_cityscapes_trainfine_saved_model', + 'swidernet_sac_1_1_3_os16_panoptic_deeplab_cityscapes_trainfine_saved_model', + 'swidernet_sac_1_1_4.5_os16_panoptic_deeplab_cityscapes_trainfine_saved_model', + 'axial_swidernet_1_1_1_os16_axial_deeplab_cityscapes_trainfine_saved_model', + 'axial_swidernet_1_1_3_os16_axial_deeplab_cityscapes_trainfine_saved_model', + 'axial_swidernet_1_1_4.5_os16_axial_deeplab_cityscapes_trainfine_saved_model', + 'max_deeplab_s_backbone_os16_axial_deeplab_cityscapes_trainfine_saved_model', + 'max_deeplab_l_backbone_os16_axial_deeplab_cityscapes_trainfine_saved_model') +_DOWNLOAD_URL_PATTERN = 'https://storage.googleapis.com/gresearch/tf-deeplab/saved_model/%s.tar.gz' + +_MODEL_NAME_TO_URL_AND_DATASET = { + model: (_DOWNLOAD_URL_PATTERN % model, cityscapes_dataset_information()) + for model in _MODELS +} + +MODEL_URL, DATASET_INFO = _MODEL_NAME_TO_URL_AND_DATASET[MODEL_NAME] + +model_dir = tempfile.mkdtemp() + +download_path = os.path.join(model_dir, MODEL_NAME + '.gz') +urllib.request.urlretrieve(MODEL_URL, download_path) + +run_cmd("tar -xzvf " + download_path + " -C " + model_dir) + +LOADED_MODEL = tf.saved_model.load(os.path.join(model_dir, MODEL_NAME)) +def inference(image): + im = np.array(image) + output = LOADED_MODEL(tf.cast(im, tf.uint8)) + return vis_segmentation(im, output['panoptic_pred'][0], DATASET_INFO) + +title = "Deeplab2" +description = "demo for Deeplab2. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below." +article = "
DeepLab2: A TensorFlow Library for Deep Labeling | Github Repo
" + +gr.Interface( + inference, + [gr.inputs.Image(type="pil", label="Input")], + gr.outputs.Image(type="plot", label="Output"), + title=title, + description=description, + article=article).launch() From ea07ce14800fd1d24db299dde2947828390e376d Mon Sep 17 00:00:00 2001 From: AK391 <81195143+AK391@users.noreply.github.com> Date: Tue, 22 Jun 2021 17:42:21 -0400 Subject: [PATCH 02/19] add examples --- gradio/demo.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gradio/demo.py b/gradio/demo.py index bd5394d..5349099 100644 --- a/gradio/demo.py +++ b/gradio/demo.py @@ -11,9 +11,13 @@ import tensorflow as tf import gradio as gr -from google.colab import files from subprocess import call import sys +import torch + +# Images +torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2021/01/28/18/21/beach-5958718_1280.jpg', 'town.jpg') +torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2021/06/19/20/30/bird-6349407_1280.jpg', 'bird.jpg') DatasetInfo = collections.namedtuple( 'DatasetInfo', @@ -256,4 +260,8 @@ def inference(image): gr.outputs.Image(type="plot", label="Output"), title=title, description=description, - article=article).launch() + article=article, + examples=[ + ["town.jpg"], + ["bird.jpg"] + ]).launch() From b4a888d048382a175477ed234635a55e03d77502 Mon Sep 17 00:00:00 2001 From: AK391 <81195143+AK391@users.noreply.github.com> Date: Tue, 22 Jun 2021 17:44:21 -0400 Subject: [PATCH 03/19] add reqs --- requirements.txt | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..deca052 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +matplotlib +numpy +Pillow +torch +torchvision +tensorflow From 430d103de36ebbf7d3de986e287f6552a3a10548 Mon Sep 17 00:00:00 2001 From: AK391 <81195143+AK391@users.noreply.github.com> Date: Tue, 22 Jun 2021 18:11:29 -0400 Subject: [PATCH 04/19] update link and resize --- gradio/demo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gradio/demo.py b/gradio/demo.py index 5349099..0a5a830 100644 --- a/gradio/demo.py +++ b/gradio/demo.py @@ -246,13 +246,14 @@ def run_cmd(command): LOADED_MODEL = tf.saved_model.load(os.path.join(model_dir, MODEL_NAME)) def inference(image): + image = image.resize(size=(512, 512)) im = np.array(image) output = LOADED_MODEL(tf.cast(im, tf.uint8)) return vis_segmentation(im, output['panoptic_pred'][0], DATASET_INFO) title = "Deeplab2" description = "demo for Deeplab2. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below." -article = "DeepLab2: A TensorFlow Library for Deep Labeling | Github Repo
" +article = "DeepLab2: A TensorFlow Library for Deep Labeling | Github Repo
" gr.Interface( inference, From 1cd70b6af7121c3184ea541d6e5093a731eedb78 Mon Sep 17 00:00:00 2001 From: AK391 <81195143+AK391@users.noreply.github.com> Date: Tue, 22 Jun 2021 19:13:33 -0400 Subject: [PATCH 05/19] 256 --- gradio/demo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradio/demo.py b/gradio/demo.py index 0a5a830..2a6a5c7 100644 --- a/gradio/demo.py +++ b/gradio/demo.py @@ -246,7 +246,7 @@ def run_cmd(command): LOADED_MODEL = tf.saved_model.load(os.path.join(model_dir, MODEL_NAME)) def inference(image): - image = image.resize(size=(512, 512)) + image = image.resize(size=(256, 256)) im = np.array(image) output = LOADED_MODEL(tf.cast(im, tf.uint8)) return vis_segmentation(im, output['panoptic_pred'][0], DATASET_INFO) From f8f37559a8ce7c91255ebf13a1b7c95c10230f63 Mon Sep 17 00:00:00 2001 From: AK391 <81195143+AK391@users.noreply.github.com> Date: Thu, 24 Jun 2021 19:22:52 -0400 Subject: [PATCH 06/19] add gradio --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index deca052..7d00250 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,4 @@ Pillow torch torchvision tensorflow +gradio From 49bedfbf9505031d43406a85a59e4f4f0c1d8a94 Mon Sep 17 00:00:00 2001 From: AK391 <81195143+AK391@users.noreply.github.com> Date: Thu, 24 Jun 2021 19:33:47 -0400 Subject: [PATCH 07/19] no torch --- gradio/demo.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gradio/demo.py b/gradio/demo.py index 2a6a5c7..5aaeddb 100644 --- a/gradio/demo.py +++ b/gradio/demo.py @@ -13,11 +13,13 @@ from subprocess import call import sys -import torch - -# Images -torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2021/01/28/18/21/beach-5958718_1280.jpg', 'town.jpg') -torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2021/06/19/20/30/bird-6349407_1280.jpg', 'bird.jpg') +import urllib +url, filename = ("https://cdn.pixabay.com/photo/2021/01/28/18/21/beach-5958718_1280.jpg", "town.jpg") +try: urllib.URLopener().retrieve(url, filename) +except: urllib.request.urlretrieve(url, filename) +url, filename = ("https://cdn.pixabay.com/photo/2021/06/19/20/30/bird-6349407_1280.jpg", "bird.jpg") +try: urllib.URLopener().retrieve(url, filename) +except: urllib.request.urlretrieve(url, filename) DatasetInfo = collections.namedtuple( 'DatasetInfo', From 88b9024eceb0bd4c91638c5df583c98a020c643e Mon Sep 17 00:00:00 2001 From: AK391 <81195143+AK391@users.noreply.github.com> Date: Thu, 24 Jun 2021 19:34:22 -0400 Subject: [PATCH 08/19] remove torch --- requirements.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 7d00250..17b9290 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,5 @@ matplotlib numpy Pillow -torch -torchvision tensorflow gradio From 981511013d9282122d94d833ce8e734ed6fda175 Mon Sep 17 00:00:00 2001 From: AK391 <81195143+AK391@users.noreply.github.com> Date: Thu, 24 Jun 2021 19:41:50 -0400 Subject: [PATCH 09/19] tf images --- gradio/demo.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/gradio/demo.py b/gradio/demo.py index 5aaeddb..bb188ab 100644 --- a/gradio/demo.py +++ b/gradio/demo.py @@ -13,13 +13,17 @@ from subprocess import call import sys -import urllib -url, filename = ("https://cdn.pixabay.com/photo/2021/01/28/18/21/beach-5958718_1280.jpg", "town.jpg") -try: urllib.URLopener().retrieve(url, filename) -except: urllib.request.urlretrieve(url, filename) -url, filename = ("https://cdn.pixabay.com/photo/2021/06/19/20/30/bird-6349407_1280.jpg", "bird.jpg") -try: urllib.URLopener().retrieve(url, filename) -except: urllib.request.urlretrieve(url, filename) + +tf.keras.utils.get_file( + "town.jpg", + "https://cdn.pixabay.com/photo/2021/01/28/18/21/beach-5958718_1280.jpg", + untar=False) + +tf.keras.utils.get_file( + "bird.jpg", + "https://cdn.pixabay.com/photo/2021/06/19/20/30/bird-6349407_1280.jpg", + untar=False) + DatasetInfo = collections.namedtuple( 'DatasetInfo', From 9d62b9d6cfa25bdd9baa31ecd99c352c80b94590 Mon Sep 17 00:00:00 2001 From: AK391 <81195143+AK391@users.noreply.github.com> Date: Thu, 24 Jun 2021 22:37:20 -0400 Subject: [PATCH 10/19] take out examples --- gradio/demo.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/gradio/demo.py b/gradio/demo.py index bb188ab..bf3dc5f 100644 --- a/gradio/demo.py +++ b/gradio/demo.py @@ -14,15 +14,15 @@ from subprocess import call import sys -tf.keras.utils.get_file( - "town.jpg", - "https://cdn.pixabay.com/photo/2021/01/28/18/21/beach-5958718_1280.jpg", - untar=False) +# tf.keras.utils.get_file( +# "town.jpg", +# "https://cdn.pixabay.com/photo/2021/01/28/18/21/beach-5958718_1280.jpg", +# untar=False) -tf.keras.utils.get_file( - "bird.jpg", - "https://cdn.pixabay.com/photo/2021/06/19/20/30/bird-6349407_1280.jpg", - untar=False) +# tf.keras.utils.get_file( +# "bird.jpg", +# "https://cdn.pixabay.com/photo/2021/06/19/20/30/bird-6349407_1280.jpg", +# untar=False) DatasetInfo = collections.namedtuple( @@ -267,8 +267,4 @@ def inference(image): gr.outputs.Image(type="plot", label="Output"), title=title, description=description, - article=article, - examples=[ - ["town.jpg"], - ["bird.jpg"] - ]).launch() + article=article).launch() From 1c0b9705bc225aeadfb85acfed00908f76659e3f Mon Sep 17 00:00:00 2001 From: AK391 <81195143+AK391@users.noreply.github.com> Date: Thu, 24 Jun 2021 23:36:47 -0400 Subject: [PATCH 11/19] gpu tf --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 17b9290..8fed322 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ matplotlib numpy Pillow -tensorflow +tensorflow-gpu gradio From 7dc68bec3426d96845705eb3db5a415b47703e73 Mon Sep 17 00:00:00 2001 From: AK391 <81195143+AK391@users.noreply.github.com> Date: Fri, 25 Jun 2021 14:24:41 -0400 Subject: [PATCH 12/19] add back examples --- gradio/demo.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/gradio/demo.py b/gradio/demo.py index bf3dc5f..47c7492 100644 --- a/gradio/demo.py +++ b/gradio/demo.py @@ -14,15 +14,15 @@ from subprocess import call import sys -# tf.keras.utils.get_file( -# "town.jpg", -# "https://cdn.pixabay.com/photo/2021/01/28/18/21/beach-5958718_1280.jpg", -# untar=False) +tf.keras.utils.get_file( + "town.jpg", + "https://cdn.pixabay.com/photo/2021/01/28/18/21/beach-5958718_1280.jpg", + untar=False) -# tf.keras.utils.get_file( -# "bird.jpg", -# "https://cdn.pixabay.com/photo/2021/06/19/20/30/bird-6349407_1280.jpg", -# untar=False) +tf.keras.utils.get_file( + "bird.jpg", + "https://cdn.pixabay.com/photo/2021/06/19/20/30/bird-6349407_1280.jpg", + untar=False) DatasetInfo = collections.namedtuple( @@ -267,4 +267,8 @@ def inference(image): gr.outputs.Image(type="plot", label="Output"), title=title, description=description, - article=article).launch() + article=article, + examples=[ + ["town.jpg"], + ["bird.jpg"] + ]).launch() From d52cda9a72f90bd019e9b1b40433daafd601b9ae Mon Sep 17 00:00:00 2001 From: AK391 <81195143+AK391@users.noreply.github.com> Date: Fri, 25 Jun 2021 16:35:33 -0400 Subject: [PATCH 13/19] add images --- gradio/demo.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/gradio/demo.py b/gradio/demo.py index 47c7492..90d08c6 100644 --- a/gradio/demo.py +++ b/gradio/demo.py @@ -14,15 +14,15 @@ from subprocess import call import sys -tf.keras.utils.get_file( - "town.jpg", - "https://cdn.pixabay.com/photo/2021/01/28/18/21/beach-5958718_1280.jpg", - untar=False) - -tf.keras.utils.get_file( - "bird.jpg", - "https://cdn.pixabay.com/photo/2021/06/19/20/30/bird-6349407_1280.jpg", - untar=False) +import requests + +url1 = 'https://cdn.pixabay.com/photo/2021/01/28/18/21/beach-5958718_1280.jpg' +r = requests.get(url, allow_redirects=True) +open("town.jpg", 'wb').write(r.content) + +url2 = 'https://cdn.pixabay.com/photo/2014/05/20/21/20/bird-349026_1280.jpg' +r = requests.get(url2, allow_redirects=True) +open("bird.jpg", 'wb').write(r.content) DatasetInfo = collections.namedtuple( From 9a6f873b3387bf8a07ab0c81620413108be5778c Mon Sep 17 00:00:00 2001 From: AK391 <81195143+AK391@users.noreply.github.com> Date: Fri, 25 Jun 2021 16:47:28 -0400 Subject: [PATCH 14/19] change url --- gradio/demo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradio/demo.py b/gradio/demo.py index 90d08c6..aa2ad94 100644 --- a/gradio/demo.py +++ b/gradio/demo.py @@ -17,7 +17,7 @@ import requests url1 = 'https://cdn.pixabay.com/photo/2021/01/28/18/21/beach-5958718_1280.jpg' -r = requests.get(url, allow_redirects=True) +r = requests.get(url1, allow_redirects=True) open("town.jpg", 'wb').write(r.content) url2 = 'https://cdn.pixabay.com/photo/2014/05/20/21/20/bird-349026_1280.jpg' From 97d03bc2b90603d77761edcf031161cda476c264 Mon Sep 17 00:00:00 2001 From: AK391 <81195143+AK391@users.noreply.github.com> Date: Fri, 25 Jun 2021 17:41:21 -0400 Subject: [PATCH 15/19] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index ce79716..e2ee8da 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,11 @@ We list a few projects that use DeepLab2. * Colab notebook for off-the-shelf inference.