8. Make a
RecordIO file
Select valid files
Cleanup files (now I know)
Make a directoryfile
Use im2rec.py to create a huge
RecordIO file.
9. Kickoff sagemaker
Just opened up an image classification example
based upon Resnet.
And trained it with changing parameters, by
editing the notebook.
After 10 iterations (about 30 hours of training)
using 70% trainingdata the best score was 81%.
Which is not good enough……
11. Did the thing
that I did not
want to do.
Slice the image
and infer all
separate images.
12. Kickoff sagemaker again
Just opened up an image classification example
based upon Resnet.
And trained it once for four hours
After 1 iteration using 70% trainingdata the score
would be 99% (for 1 spot)
This is satisfactory
13. Make the
lambda
function a bit
smarter.
Use CV to make 4
images out of the
camera image.
Resize these images
Infer every image
until one spot is
free.
Send the result to
an s3 bucket
17. What I
learned
• DeepLens is developer hardware
• Windows require cleaning
• Preprocessing is am must
• Expect connectionproblems when moving the
camera
• Writing logging is a good thing
• Put gaffertape on the blue leds
• Think twice before you promise your family
something
leon@devoto.nl
At re:invent and similar conferences one tends to receive endless amounts of swag, not all swag is welcomed by my familymembers. The hoodies rank high on the not wanted list . But some of the electronic items are welcomed by curiosity.
Upon explaining the possibilities of AWS-DeepLens my family had an idea
“Can you notify me I if there is parking available next to our house, as soon as I drive into our village?’
Sure I said. I figured my total lack of knowledge of machinelearning would easily be overcome.
Explain components in this diagram. Explain the lambdafuntion is running local, but stress the coonectivity of the device and the possibility to integrate remote AWS services.
Finding empty parkingplaces based upon a cameraimage is probably cheaper and easier using a specific algorithm coded for this use-case. If you use cv and flatten some parts of the image, and look at variance in color, or look for certain features (curved lines are a great indicator)
For this challenge we expect to train a model without adding any hand crafted ‘intelligence’ and let machinelearning figure out how to detected available parkingplaces.
Explain the basic steps in the diagram.
Learning data was produced by placing the camera in a window and make the lambda function send an image to s3 every 5 minutes for a week. We deleted identical images by comparing resized and flattened versions of concurrent images. (Had to take extra measures to remove the flag in the picture that made every daytime picture unique.
Tagging the picture with a value of available or full was done by running a s3 batch operation which called aws rekognition. We parsed rekognitions results and checked for the presence of cars within certain coordinates after calculating parking availability we tagged the s3 files with the availability.
Machinelearning apparently requires RecordIO files, so we created them. We should have done more cleanup and should have left out some delivery-trucks, and pictures where the window so moist that the picture was unusable. Making RecordIO file takes disk and time.
I used the standard highlevel image classification sample notebook in Sagemaker and moved in my own images.
After putting in 30 hours of training with changing parameter.
Some (red) cars were only visible on full parking lots. The model recognized them as meaning: Parkinglot full.
At night the parking is full, The model decided that dark sky means: Parkinglot full.
The cars in the background seemed influential.
During rain dark cars were not recognized.
Since I did not get the model good enough I decided to make new training data by slicing all images, resizing to a standard size this became the new training-data. (Used 400 images per parking-spot)
Run the same notebook.
Just deployed through deeplens console.
Since I did want to send a notification als soon as you enter the village I installed the IFTTT app on the phone.
Made it call a webhook upon entering our village.
The webhook activates an api-gateway that triggers a lambda function, that check the status on S3 and sends an SNS notification, that delivered a sms-message that I configured to a specific ringtone. By using two separate caller-id’s for Full and available I was able to have a different ringtone for both conditions.
(Could not get my family to pose in this picture, so this is a photo from google)
DeepLens can get hot and does chrash about once a week.