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
self.bastion_host = ec2.Instance(self, id=f'{resources_prefix}-bastion-host', | |
instance_type=ec2.InstanceType(instance_type_identifier='t2.micro'), | |
machine_image=ec2.AmazonLinuxImage( | |
edition=ec2.AmazonLinuxEdition.STANDARD, | |
generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, | |
virtualization=ec2.AmazonLinuxVirt.HVM, | |
storage=ec2.AmazonLinuxStorage.GENERAL_PURPOSE | |
), | |
vpc=self.vpc, | |
key_name='pryan-aws', # must create the key name manually first |
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
self.bastion_sg = ec2.SecurityGroup(self, id=f'{resources_prefix}-bastion-sg', | |
security_group_name=f'{resources_prefix}-cdk-bastion-sg', | |
vpc=self.vpc, | |
description=f'{resources_prefix} SG for Bastion', | |
allow_all_outbound=True) | |
self.bastion_sg.add_ingress_rule(peer=ec2.Peer.ipv4('xxx.xxx.xxx.xx/32'), # only your machine | |
connection=ec2.Port.tcp(22), | |
description='SSH Access') | |
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
ec2.Vpc(self, id=f'{resources_prefix}-VPC', | |
cidr='10.40.0.0/16', | |
max_azs=1, | |
enable_dns_hostnames=True, | |
enable_dns_support=True, | |
subnet_configuration=[ | |
ec2.SubnetConfiguration( | |
name="Public", | |
subnet_type=ec2.SubnetType.PUBLIC, | |
cidr_mask=24 |
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
from aws_cdk import ( | |
Stack, | |
aws_apigatewayv2_alpha as api_gw, | |
aws_apigatewayv2_integrations_alpha as integrations, | |
CfnOutput, | |
aws_lambda_python_alpha as lambda_alpha_, | |
aws_lambda as _lambda | |
) | |
from constructs import Construct |
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
python -m mo --reverse_input_channels --batch 1 --mean_values \[127.5, 127.5, 127.5\] --scale_values \[127.5, 127.5, 127.5\] --saved_model_dir ./mask_detector --output_dir openvino_model | |
rm /Users/patrickryan/.cache/blobconverter/saved_model_openvino_2021.4_6shave.blob | |
blobconverter --openvino-xml ./openvino_model/saved_model.xml --openvino-bin ./openvino_model/saved_model.bin --shaves 6 --output-dir ./openvino_model --no-cache |
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 # numpy - manipulate the packet data returned by depthai | |
import cv2 # opencv - display the video stream | |
import depthai # depthai - access the camera and its data packets | |
import blobconverter # blobconverter - compile and download MyriadX neural network blobs | |
""" | |
https://docs.luxonis.com/projects/api/en/latest/tutorials/hello_world/ | |
Also used information from this example to pull the labels and label detections | |
https://docs.luxonis.com/projects/api/en/latest/samples/MobileNet/rgb_mobilenet/#rgb-mobilenetssd |
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 cv2 # opencv - display the video stream | |
import depthai # depthai - access the camera and its data packets | |
def main(): | |
# Create empty processing pipeline | |
pipeline = depthai.Pipeline() | |
# cam_rgb is a ColorCamera node. | |
# https://docs.luxonis.com/projects/api/en/latest/components/nodes/color_camera/ | |
cam_rgb = pipeline.create(depthai.node.ColorCamera) |
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
with depthai.Device(pipeline) as device: | |
q_rgb = device.getOutputQueue("rgb") | |
frame = None | |
while True: | |
in_rgb = q_rgb.tryGet() | |
if in_rgb is not None: | |
frame = in_rgb.getCvFrame() | |
if frame is not None: | |
cv2.imshow("OAK-1", frame) |
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 empty processing pipeline | |
pipeline = depthai.Pipeline() | |
# cam_rgb is a ColorCamera node. | |
# https://docs.luxonis.com/projects/api/en/latest/components/nodes/color_camera/ | |
cam_rgb = pipeline.create(depthai.node.ColorCamera) | |
cam_rgb.setPreviewSize(400, 400) | |
# Set planar or interleaved data of preview output frames | |
cam_rgb.setInterleaved(False) |
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
version: '3.8' | |
# .env.docker | |
# DATABASE_URL=postgres://postgres:postgres@db/mydb | |
# POSTGRES_USER=postgres | |
# POSTGRES_PASSWORD=postgres | |
# POSTGRES_DB=mydb | |
services: | |
web: |