fxgsell / gg-edge-inference Goto Github PK
View Code? Open in Web Editor NEWUsing AWS Greengrass with the Nvidia Jetson TX2 to run ML models prepared with Amazon SageMaker.
License: MIT License
Using AWS Greengrass with the Nvidia Jetson TX2 to run ML models prepared with Amazon SageMaker.
License: MIT License
1-greengrass-deployment
make execution fails:
ec2-user:~/environment/GG-Edge-Inference/2-face-detection (master) $ make
echo "Zipping..."
Zipping...
rm -f package.zip
zip -rq package.zip greengrass_common greengrass_ipc_python_sdk greengrasssdk *.py
echo "Uploading to Lambda"
Uploading to Lambda
aws --profile default --region us-east-1 lambda update-function-code --function-name --zip-file fileb://`pwd`/package.zip
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument --function-name: expected one argument
make: *** [deploy] Error 2
properties.mk
# Static
PROFILE=default
LAMBDA_ALIAS=latest
AWS_COMMAND=aws --profile $(PROFILE) --region $(REGION)
# Edit these values (where required)
REGION=us-east-1
GG_GROUP=ml-edge-workshop
BUCKET=ml-edge-workshop-shirkeys
Is function_name a value we need to pass? Assuming that could be changed during Lab 1, including it would make sense
make output
ec2-user:~/environment/GG-Edge-Inference/2-face-detection (master) $ make
echo "Zipping..."
Zipping...
rm -f package.zip
zip -rq package.zip greengrass_common greengrass_ipc_python_sdk greengrasssdk *.py
echo "Uploading to Lambda"
Uploading to Lambda
aws --profile default --region us-east-1 lambda update-function-code --function-name ml-edge-workshop-lab-1 --zip-file fileb://`pwd`/package.zip
{
"TracingConfig": {
"Mode": "PassThrough"
},
"CodeSha256": "x4otKs1etleHIqP+H5tMfeRe9D5DUhGK44wQ4svy1tk=",
"FunctionName": "ml-edge-workshop-lab-1",
"CodeSize": 21229,
"MemorySize": 128,
"FunctionArn": "arn:aws:lambda:us-east-1:306280812807:function:ml-edge-workshop-lab-1",
"Version": "$LATEST",
"Role": "arn:aws:iam::306280812807:role/ml-edge-workshop-lab-1-role",
"Timeout": 3,
"LastModified": "2018-06-09T12:14:53.463+0000",
"Handler": "lambda_function.lambda_handler",
"Runtime": "python2.7",
"Description": ""
}
aws --profile default --region us-east-1 lambda publish-version --function-name ml-edge-workshop-lab-1 --query Version --output text > LAMBDA_VERSION
aws --profile default --region us-east-1 lambda update-alias --name latest --function-name ml-edge-workshop-lab-1 --function-version `cat LAMBDA_VERSION`
{
"AliasArn": "arn:aws:lambda:us-east-1:306280812807:function:ml-edge-workshop-lab-1:latest",
"FunctionVersion": "1",
"Name": "latest",
"Description": ""
}
rm LAMBDA_VERSION
echo "Deploying to GG"
Deploying to GG
aws --profile default --region us-east-1 greengrass list-groups --query "Groups[?Name=='ml-edge-workshop'].Id" --output text > GROUP_ID
aws --profile default --region us-east-1 greengrass list-groups --query "Groups[?Name=='ml-edge-workshop'].LatestVersion" --output text > GROUP_VERSION
aws --profile default --region us-east-1 greengrass create-deployment --group-id `cat GROUP_ID` --deployment-type NewDeployment --group-version-id `cat GROUP_VERSION` --query "DeploymentId" --output text > GROUP_DEPLOYMENT
aws --profile default --region us-east-1 greengrass get-deployment-status --group-id `cat GROUP_ID` --deployment-id `cat GROUP_DEPLOYMENT` --query "DeploymentStatus" --output text > STATUS
Build in progress: Building
rm GROUP_ID GROUP_VERSION GROUP_DEPLOYMENT STATUS
manual steps to inspect output of deployment steps (ie. STATUS file before it is deleted)
ec2-user:~/environment/GG-Edge-Inference/2-face-detection (master) $ aws --profile default --region us-east-1 greengrass list-groups --query "Groups[?Name=='ml-edge-workshop'].Id" --output text > GROUP_ID
ec2-user:~/environment/GG-Edge-Inference/2-face-detection (master) $ aws --profile default --region us-east-1 greengrass list-groups --query "Groups[?Name=='ml-edge-workshop'].LatestVersion" --output text > GROUP_VERSION
ec2-user:~/environment/GG-Edge-Inference/2-face-detection (master) $ aws --profile default --region us-east-1 greengrass create-deployment --group-id `cat GROUP_ID` --deployment-type NewDeployment --group-version-id `cat GROUP_VERSION` --query "DeploymentId" --output text > GROUP_DEPLOYMENT
ec2-user:~/environment/GG-Edge-Inference/2-face-detection (master) $ aws --profile default --region us-east-1 greengrass get-deployment-status --group-id `cat GROUP_ID` --deployment-id `cat GROUP_DEPLOYMENT` --query "DeploymentStatus" --output text > STATUS
ec2-user:~/environment/GG-Edge-Inference/2-face-detection (master) $ cat ./STATUS
Failure
ec2-user:~/environment/GG-Edge-Inference/1-greengrass-configuration (master) $ python3 create-greengrass-config.py --create-group ml-edge-workshop --bucket ml-edge-workshop-lab-1 --function ml-edge-workshop-lab-1
Creating IAM role for Greengrass
Traceback (most recent call last):
File "create-greengrass-config.py", line 294, in
state = create_group(args.group_name, args.bucket)
File "create-greengrass-config.py", line 182, in create_group
role, role_policy = create_gg_role(bucket, certificate['certificateArn'][-10:])
File "create-greengrass-config.py", line 125, in create_gg_role
AssumeRolePolicyDocument=json.dumps(assume_role_document)
File "/opt/c9/python3/local/lib/python3.6/dist-packages/botocore/client.py", line 314, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/opt/c9/python3/local/lib/python3.6/dist-packages/botocore/client.py", line 612, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidClientTokenId) when calling the CreateRole operation: The security token included in the request is invalid
$ python3 create-greengrass-config.py --create-group ml-edge-workshop --bucket ml-edge-workshop-lab-1 --function ml-edge-workshop-lab-1
Creating IAM role for Greengrass
Generating configuration package
Configuration and certificates generated: certificates.zip
Traceback (most recent call last):
File "create-greengrass-config.py", line 311, in
state = add_function(args.function_name, state)
File "create-greengrass-config.py", line 209, in add_function
function = static_config.FUNCTION_INITIAL_VERSION
AttributeError: module 'static_config' has no attribute 'FUNCTION_INITIAL_VERSION'
Hi, I wonder how to improve the precision in AWS Rekognition, since I recently tested with multiple people, but sadly returned with same face id.
Sometimes have to wait several minutes until the face was detected as a different one.
Is there any way to fix the code or set similarity threshold higher?
By the way, I am using Raspberry Pi 3 and a logitech c310 webcam.
Thank you!
➜ 3-hybrid-face-recognition git:(master) ✗ make
make -C function
zip -r hybrid-face-recognition.zip *
adding: Makefile (deflated 8%)
adding: lambda_function.py (deflated 61%)
aws cloudformation package \
--template-file hybrid-face-recognition.yml \
--s3-bucket my-bucket \
--output-template-file hybrid-face-recognition-release.yml
Unable to upload artifact ./function/hybrid-face-recognition.zip referenced by CodeUri parameter of FaceRecognition resource.
An error occurred (AllAccessDisabled) when calling the PutObject operation: All access to this object has been disabled
make: *** [build] Error 255
Hi, Thanks for the wonderful project.
I want to use the webcam (Logitech C310) instead of onboard camera on jetson tx2.
How to use the webcam video stream from "/dev/video1" for the face detection project?
When stopping / starting per this page
where:
Restart the AWS Greengrass daemon by running the following commands in your core device terminal.
cd /greengrass/ggc/core/
sudo ./greengrassd stop
sudo ./greengrassd start
then, when executed on device:
nvidia@tegra-ubuntu:/greengrass/ggc/core$ sudo ./greengrassd stop
[sudo] password for nvidia:
nvidia@tegra-ubuntu:/greengrass/ggc/core$ sudo ./greengrassd start
Setting up greengrass daemon
Validating hardlink/softlink protection
Validating execution environment
Found cgroup subsystem: cpuset
Found cgroup subsystem: cpu
Found cgroup subsystem: cpuacct
Found cgroup subsystem: blkio
Found cgroup subsystem: memory
Found cgroup subsystem: devices
Found cgroup subsystem: freezer
Found cgroup subsystem: net_cls
Found cgroup subsystem: perf_event
Found cgroup subsystem: net_prio
Found cgroup subsystem: pids
Found cgroup subsystem: debug
Starting greengrass daemon
Greengrass daemon 11306 failed to start
Failed to parse config.json. err: UseSystemd [[yes|no]] is invalid, please use "yes" or "no"
nvidia@tegra-ubuntu:/greengrass/ggc/core$
and when catting config.json:
nvidia@tegra-ubuntu:/greengrass/ggc/core$ cat /greengrass/config/config.json
{
"coreThing": {
"caPath": "[ROOT_CA_PEM_HERE]",
"certPath": "[CLOUD_PEM_CRT_HERE]",
"keyPath": "[CLOUD_PEM_KEY_HERE]",
"thingArn": "[THING_ARN_HERE]",
"iotHost": "[HOST_PREFIX_HERE].iot.[AWS_REGION_HERE].amazonaws.com",
"ggHost": "greengrass.iot.[AWS_REGION_HERE].amazonaws.com"
},
"runtime": {
"cgroup": {
"useSystemd": "[yes|no]"
}
},
"managedRespawn": false
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.