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
#!/bin/bash | |
X=858 | |
Y=480 | |
mplayer -demuxer lavf -lavfdopts format=mjpeg:probesize=32 /tmp/results.mjpeg -x $X -y $Y |
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 io, boto3 | |
import numpy as np | |
from PIL import Image | |
from botocore.exceptions import ClientError | |
REGION = 'us-east-2' | |
CollectionId = '<CollectionID>' | |
def get_name(frame): | |
rekognition = boto3.client('rekognition', region_name=REGION) |
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
# put the output manifest file to your S3 (in the us-east-1 region). | |
object = 's3://aft-vbi-pds/bin-images/{:05}.jpg' | |
with open('aft-vbi-pds-manifest.json', 'w') as f: | |
for i in range(1, 100000): | |
f.write('{"source-ref":"' + object.format(i) + '"}\n') |
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_tutorial.ipynb | |
od_model = sagemaker.estimator.Estimator(training_image, | |
role, | |
train_instance_count=1, | |
train_instance_type='ml.p3.2xlarge', | |
train_volume_size = 50, | |
train_max_run = 360000, | |
input_mode = 'Pipe', | |
output_path=s3_output_path, |
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 time | |
import json | |
import boto3 | |
def create_endpoint(event, job_name_prefix='machine-learning-pipeline'): | |
sagemaker_client = boto3.client('sagemaker') | |
# create model | |
timestamp = time.strftime('-%Y-%m-%d-%H-%M-%S', time.gmtime()) | |
model_name= job_name_prefix + timestamp |
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
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"). | |
# You may not use this file except in compliance with the License. | |
# A copy of the License is located at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# or in the "license" file accompanying this file. This file is distributed | |
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#!/bin/bash | |
mkdir python | |
python3 -m pip install -r sagemaker-sdk-requirements.txt -t ./python/ --no-deps | |
zip sagemaker-sdk-layer.zip -r ./python/ | |
rm -rf python |
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
#!/bin/bash | |
set -e | |
sudo -u ec2-user -i <<'EOF' | |
git clone https://github.com/awslabs/git-secrets.git | |
cd git-secrets/ | |
sudo make install | |
git secrets --register-aws --global |
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
#!/bin/bash | |
set -e | |
# OVERVIEW | |
# This script installs a single pip package in a single SageMaker conda environments. | |
# Slightly modified from https://github.com/aws-samples/amazon-sagemaker-notebook-instance-lifecycle-config-samples/blob/master/scripts/install-pip-package-single-environment/on-start.sh | |
sudo -u ec2-user -i <<'EOF' | |
# PARAMETERS |
OlderNewer