This repo is an attempt at setting up serverless computer vision applications using AWS services. For this implementation I have used TensorFlow but the stack can be used with any application/framework.
You can leverage this package and its packages to build your own pipeline using AWS.
- cfn-template.yml - Cloudformation template to setup necessary S3 buckets, Cognito Authentication, IAM roles and policies
- template.yml - Contains SAM template for Lambda function and API Gateway
- swagger.yml - Contains API specifications
- run.sh - Bash script containing all the necessary commands to setup and deploy the stack.
- Setup
virtualenv
and installnode_modules
bash run.sh setup
- Create IAM user on AWS with admin access and use the access_key and secret_key to configure aws credentials locally.
bash run.sh aws_config
- Copy/Download the model(s) into /models directory. You can use my Yolo model for this setup
wget https://www.dropbox.com/s/h8ywy9lp8siw0ml/yolo_tf.pb -P models/
- Deploy the entire stack
bash run.sh deploy
- Deploy the basic stack containing S3, Cognito and IAM.
bash run.sh deploy_stack
- Upload model(s) to S3 bucket.
bash run.sh deploy_model
- Build and deploy static assest i.e entire frontend built using React
bash run.sh deploy_website
- Build and deploy lambdas
bash run.sh deploy_lambdas
-
Follow the first 4 steps from setup instructions.
-
Start the api locally
npm run sam local start-api
-
Replace API_URL in /src/actions/index.jsx with the local url.
-
Run the local node server locally.
npm run watch
-
Open http://localhost:3000/ in the browser
-
Drop images in the application to upload them to S3.
-
If you want to debug the function you can invoke the function locally once the images are in S3. The will generate better logs.
npm run sam local invoke ProcessImage -- --event fixtures/ProcessImage.json
- Code Size: 261 Mb
- Persistant Storage: 512 Mb