Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| # folder where the image is already saved (without bounding boxes) | |
| data_dir = 'media/stable_numbers/number_crops/' | |
| # folder where the new image with bounding boxes should be saved | |
| out_dir = 'media/copy_labeled_number_crops/' | |
| # go through the unique file names (because files can have more than 1 bounding box) | |
| for file in new_df.filename.unique(): | |
| # load in the image and .loc[] the rows where it's referenced (each row represents 1 bounding box) |
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 pynvml | |
| pynvml.nvmlInit() | |
| handle = pynvml.nvmlDeviceGetHandleByIndex(0) | |
| device_name = pynvml.nvmlDeviceGetName(handle) | |
| if (device_name != b'Tesla T4') and (device_name != b'Tesla P4') and (device_name != b'Tesla P100-PCIE-16GB'): | |
| raise Exception(""" | |
| Unfortunately this instance does not have a T4, P4 or P100 GPU.\n | |
| Please make sure you've configured Colab to request a GPU instance type.\n |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 os | |
| import urllib | |
| def data_check(file_name, data_dir='', base_url='https://s3.amazonaws.com/nyc-tlc/trip+data/'): | |
| """ | |
| 1. check if the given {file_name} exists locally in {data_dir} | |
| 2. download from {base_url} & save in {data_dir) if not | |
| INPUTS | |
| > file_name |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.