Train your Hard Hat model
Train and Test a Hard Hat Detection Model¶
This section demonstrates how to install the Cloud Annotations cacli, train a Tensorflow model, download the model, set up a sample localhost web application and test model on your laptop.
Lab Objectives¶
In this lab you will learn how to:
- Install Cloud Annotations cacli
- Train a Tensorflow model
- Download the model with the cacli
- git clone object-detection-react
- Test model on your laptop
Cloud Annotations cacli Install¶
Now that the Hard Hat training data set has been uploaded to IBM Cloud Object Storage, we can train our model using the Cloud Annotations command line interface, cacli
The cacli is available for Linux, Mac, Windows. Follow the download and installation instructions
Cloud Annotations - Login / Train¶
- Login to your IBM Cloud account using
cacli login
and answer the OTP prompts
$ cacli login
- Train your hard hat object detection model
$ cacli train
- Select your
hardhat-detection-<your_initials>
Bucket. - Note the training run Model ID
- List training runs
$ cacli list
- Monitor the progress of your training runs
$ cacli progress model-58sdpqyx
- Wait for the model training to complete (15-30 minutes) - Download the model
$ cacli download model-58sdpqyx
success download complete
Set up a Object Detection web application on your local system¶
The Cloud Annotations github repository includes an object detection react web application that you can install locally.
- Follow the README.md instructions
- (or) Run these commands:
$ git clone git@github.com:cloud-annotations/object-detection-react.git
$ cd object-detection-react
$ npm install
-
Copy the model_web directory created by the
cacli download
and paste it into thepublic
folder of this repo directory. On my Linux system I just create a symlink. -
Start the server
$ npm start
Test the Hard Hat model on your laptop¶
Now that the object detection react web application is running, open http://localhost:3000 to view it in the browser. Share your laptop camera with the browser tab.
Find your hard hat and observe the hard hat model prediction.
Congratulations¶
You are now ready to build a Node-RED Dashboard application that will incorporate this model.