Function | Command |
---|---|
Get a list of all your environments | conda env list |
Get a list of all the packages installed in your current active environment | conda list |
Create an environment called [ENV_NAME] | `conda create --name [ENV_ |
This file contains 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
Function | Command | |
---|---|---|
Get a list of all your environments | conda env list | |
Get a list of all the packages installed in your current active environment | conda list | |
Create an environment called [ENV_NAME] | conda create --name [ENV_NAME] | |
Create an environment called [ENV_NAME] and install pandas and numpy | conda create --name [ENV_NAME] pandas numpy | |
Activate an environment called [ENV_NAME] | conda activate [ENV_NAME] | |
Create an environment folder called env in the current working directory (e.g. /Users/Daniel/project_1/) and install pandas and numpy | conda create --prefix ./env pandas numpy | |
Activate an environment stored in a folder called env which is located within /Users/Daniel/project_1/ | conda activate /Users/daniel/project_1/env | |
Deactivate an environment | conda deactivate | |
Export your current active environment to a YAML file called environment (see why below) | conda env export > environment.yaml |
This file contains 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
# Example of a Detectron2 label for image "1e2c50b991a82ee8.jpg" | |
[{'annotations': [{'bbox': [228.0, 12.0, 791.0, 858.0], | |
'bbox_mode': <BoxMode.XYXY_ABS: 0>, | |
'category_id': 0}], | |
'file_name': 'image_folder/1e2c50b991a82ee8.jpg', # this will change depending on where your images are stored | |
'height': 867, | |
'image_id': 33, | |
'width': 1024}] |
This file contains 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
# What downloading image labels from Open Images looks like | |
import pandas as pd | |
val_annots = pd.read_csv("https://storage.googleapis.com/openimages/v5/validation-annotations-bbox.csv") | |
val_annots.head() |
This file contains 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 pandas as pd | |
classnames = pd.read_csv("https://storage.googleapis.com/openimages/v5/class-descriptions-boxable.csv", | |
names=["LabelName", "ClassName"]) | |
classnames.head() |
This file contains 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
# Test our annotation formatting function | |
val_annots_formatted = format_annotations(image_folder="validation", # validation path | |
annotation_file="validation-annotations-bbox.csv", # validation annotations | |
target_classes=subset_classes) # (fireplace & coffeemaker) | |
val_annots_formatted.head() |
This file contains 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
# Create list of validation image dictionaries | |
val_img_dicts = get_image_dicts(image_folder="validation", # validation images | |
annotation_file="validation-annotations-bbox.csv", # these get formatted automatically | |
target_classes=target_classes) # list of target classes you're working with | |
>>> Using validation-annotations-bbox.csv for annotations... | |
On dataset: validation/ | |
Classes we're using: | |
Coffeemaker 21 | |
Name: ClassName, dtype: int64 |
This file contains 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
# Object detection models from the Detectron2 model zoo | |
models_to_try = { | |
# model alias : model setup instructions | |
"R50-FPN-1x": "COCO-Detection/faster_rcnn_R_50_FPN_1x.yaml", | |
"R50-FPN-3x": "COCO-Detection/faster_rcnn_R_50_FPN_3x.yaml", | |
"R101-FPN-3x": "COCO-Detection/faster_rcnn_R_101_FPN_3x.yaml", | |
"X101-FPN-3x": "COCO-Detection/faster_rcnn_X_101_32x8d_FPN_3x.yaml", | |
"RN-R50-1x": "COCO-Detection/retinanet_R_50_FPN_1x.yaml", | |
"RN-R50-3x": "COCO-Detection/retinanet_R_50_FPN_3x.yaml", | |
"RN-R101-3x": "COCO-Detection/retinanet_R_101_FPN_3x.yaml" |
This file contains 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 numpy as np | |
import pandas as pd | |
np.random.seed(0) | |
sales_amounts = np.random.randint(20, size=(5, 3)) | |
weekly_sales = pd.DataFrame(sales_amounts, | |
index=["Mon", "Tues", "Wed", "Thurs", "Fri"], | |
columns=["Almond butter", "Peanut butter", "Cashew butter"]) |
This file contains 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
# List of FashionMNIST labels, source: https://github.com/zalandoresearch/fashion-mnist | |
class_names = ["T-shirt/top", | |
"Trouser", | |
"Pullover", | |
"Dress", | |
"Coat", | |
"Sandal", | |
"Shirt", | |
"Sneaker", | |
"Bag", |
OlderNewer