Skip to content

Commit

Permalink
Copy data from bucket that is not public anymore (and add Git LFS) (G…
Browse files Browse the repository at this point in the history
…oogleCloudPlatform#711)

Co-authored-by: Abdel SGHIOUAR <abdelfettah@google.com>
  • Loading branch information
iht and boredabdel authored Nov 1, 2021
1 parent eeea121 commit 27ed6dc
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.bz2 filter=lfs diff=lfs merge=lfs -text
17 changes: 9 additions & 8 deletions examples/e2e-home-appliance-status-monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The popularization of IoT devices and the evolvement of machine learning technol
* Machine learning model development using Tensorflow and training using Cloud Machine Learning Engine (CMLE)
* Machine Learning model serving using CMLE together with App Engine as frontend
* Data visualization and exploration using Colab
![system architecture](https://storage.googleapis.com/gcp_blog/img/arch.jpg)
![system architecture](./img/arch.jpg)

## Steps to deploy the demo system

Expand Down Expand Up @@ -41,15 +41,13 @@ You also need to enable the following APIs in the APIs & Services menu.
* Cloud PubSub API

### Step 1. Deploy a trained ML model in Cloud ML Engine.
You can download our trained model [here](https://storage.googleapis.com/gcp_blog/e2e_demo/model.tar) or you can train your own model using the `ml/start.sh`.
You can download our trained model [from the `data` directory](./data/model.tar.bz2) or you can train your own model using the `ml/start.sh`.
Notice: you need to enable CLoud ML Engine API first.

If you are using our trained model:
```shell
# download our trained model
# download using curl: curl -o model.tar https://storage.googleapis.com/gcp_blog/e2e_demo/model.tar
wget https://storage.googleapis.com/gcp_blog/e2e_demo/model.tar --no-check-certificate
tar xvf model.tar
tar jxvf data/model.tar.bz2

# upload the model to your bucket
gsutil cp -r model gs://${BUCKET_NAME}
Expand Down Expand Up @@ -117,15 +115,18 @@ gcloud --project ${GOOGLE_PROJECT_ID} pubsub subscriptions create sub0 \
gcloud --project ${GOOGLE_PROJECT_ID} pubsub topics create pred
gcloud --project ${GOOGLE_PROJECT_ID} pubsub subscriptions create sub1 --topic=pred

# uncompress the data
bunzip data/*csv.bz2

# create BigQuery dataset and tables.
bq --project_id ${GOOGLE_PROJECT_ID} mk \
--dataset ${GOOGLE_PROJECT_ID}:EnergyDisaggregation
bq --project_id ${GOOGLE_PROJECT_ID} load --autodetect \
--source_format=CSV EnergyDisaggregation.ApplianceInfo \
gs://gcp_blog/e2e_demo/appliance_info.csv
./data/appliance_info.csv
bq --project_id ${GOOGLE_PROJECT_ID} load --autodetect \
--source_format=CSV EnergyDisaggregation.ApplianceStatusGroundTruth \
gs://gcp_blog/e2e_demo/appliance_status_ground_truth.csv
./data/appliance_status_ground_truth.csv
bq --project_id ${GOOGLE_PROJECT_ID} mk \
--table ${GOOGLE_PROJECT_ID}:EnergyDisaggregation.ActivePower \
time:TIMESTAMP,device_id:STRING,power:INTEGER
Expand Down Expand Up @@ -183,6 +184,6 @@ jupyter notebook

*notebook/EnergyDisaggregationDemo_Client.ipynb* simulates multiple smart meters by reading in power consumption data from a real world dataset and sends the readings to our server. All Cloud IoT Core related code resides in this notebook. Fill in the necessary information in the *Configuration* block and run all the cells, once you see messages being sent you should be able to see plots like the one shown below in *notebook/EnergyDisaggregationDemo_View.ipynb*.

![Demo system sample output](https://storage.googleapis.com/gcp_blog/img/demo03.gif)
![Demo system sample output](./img/demo03.gif)


Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/e2e-home-appliance-status-monitoring/ml/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ else
fi
fi

DATA_DIR="gs://gcp_blog/e2e_demo"
DATA_DIR="./data"
PKG_FLAGS="--train-file=${DATA_DIR}/train.csv \
--eval-file=${DATA_DIR}/valid.csv \
--test-file=${DATA_DIR}/test.csv \
Expand Down

0 comments on commit 27ed6dc

Please sign in to comment.