Skip to content

Commit 0d1fa0b

Browse files
No public description
PiperOrigin-RevId: 758797293
1 parent c8e9d32 commit 0d1fa0b

File tree

11 files changed

+262
-69
lines changed

11 files changed

+262
-69
lines changed

official/projects/waste_identification_ml/circularnet-docs/content/_index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@
4646
* [Before you begin](/official/projects/waste_identification_ml/circularnet-docs/content/view-data/before-you-begin.md)
4747
* [Configure the dashboard](/official/projects/waste_identification_ml/circularnet-docs/content/view-data/configure-dashboard.md)
4848

49+
**[Retrain CircularNet models](/official/projects/waste_identification_ml/circularnet-docs/content/retrain-models/_index.md)**
50+
51+
* [Before you begin](/official/projects/waste_identification_ml/circularnet-docs/content/retrain-models/before-you-begin.md)
52+
* [Prepare the training data](/official/projects/waste_identification_ml/circularnet-docs/content/retrain-models/prepare-data.md)
53+
* [Launch the training job](/official/projects/waste_identification_ml/circularnet-docs/content/retrain-models/launch-job.md)
54+
4955
## CircularNet overview
5056

5157
CircularNet is a free computer vision model developed by Google that utilizes
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
CircularNet provides two image-analysis models. The first detects _material
2-
types_, and the second detects _material forms_. These models utilize a Mask
3-
R-CNN algorithm for image training and implement ResNet or MobileNet as the
4-
convolutional neural networks for image classification tasks.
1+
CircularNet provides an image-analysis model. It detects _material types_, and
2+
_material forms_. The model utilizes a Mask R-CNN algorithm for image training
3+
and implements ResNet or MobileNet as the convolutional neural networks for
4+
image classification tasks.
55

6-
The models are loaded sequentially to achieve accurate predictions. When working
7-
with images, each image undergoes preprocessing before the models use them for
6+
The model is loaded sequentially to achieve accurate predictions. When working
7+
with images, each image undergoes preprocessing before the model uses them for
88
prediction. In the case of video files, the video is split into individual
99
frames at a given frame rate. These frames are then processed in the same
1010
sequential manner as images.
1111

12-
The predictions from the two models result in two distinct outputs, which are
12+
The predictions from the model result in two distinct outputs, which are
1313
then post-processed and combined into a single comprehensive output. This output
1414
includes critical information such as the number of detected objects, their
1515
bounding boxes, class names, class IDs, and masks for each object. Further
@@ -24,8 +24,8 @@ flow and real-time updates. A [prediction pipeline](./learn-about-pipeline) for
2424
Google Cloud pushes the data directly to storage buckets and BigQuery tables,
2525
which you can connect to the dashboard for [visualization and analysis](/official/projects/waste_identification_ml/circularnet-docs/content/view-data/).
2626

27-
On the other hand, direct data transfer to the cloud for edge device implementations needs a client-side configuration. A [prediction pipeline](/official/projects/waste_identification_ml/circularnet-docs/content/learn-about-pipeline) for devices lets you load models sequentially and store image analysis results locally.
27+
On the other hand, direct data transfer to the cloud for edge device implementations needs a client-side configuration. A [prediction pipeline](/official/projects/waste_identification_ml/circularnet-docs/content/learn-about-pipeline) for devices lets you load the model and store image analysis results locally.
2828

29-
This section describes how to apply the two specialized CircularNet models using
29+
This section describes how to apply the specialized CircularNet model using
3030
a prediction pipeline on the client side to prepare and analyze the images you
3131
capture.

official/projects/waste_identification_ml/circularnet-docs/content/analyze-data/prediction-pipeline-in-cloud.md

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ on Google Cloud:
9696
**Important:** Run the previous command in the `server` folder, which
9797
contains the `triton_server.sh` script.
9898
99-
1. Exit the `server` folder and open the client folder in the
99+
1. Exit the `server` folder and open the `client` folder in the
100100
`prediction_pipeline` directory:
101101
102102
```
103-
cd .. cd client/
103+
cd ..
104+
cd client/
104105
```
105106
106107
This folder contains the `pipeline_images.py` and `pipeline_videos.py`
@@ -110,22 +111,21 @@ on Google Cloud:
110111
111112
1. If you have to modify the scripts to provide your specific paths and values
112113
for the prediction pipeline, edit the corresponding parameter values on the
113-
script. The following example modifies the video pipeline script:
114+
script. The following example modifies the image pipeline script:
114115
115116
```
116-
vim run_gcp_videos.sh
117+
vim run_images.sh
117118
```
118119
119120
The Vim editor displays the following parameters:
120121
121122
```
122-
--input_directoy=<path-to-input-bucket>
123+
--input_directory=<path-to-input-bucket>
123124
--output_directory=<path-to-output-bucket>
124125
--fps=<frames-per-second>
125126
--height=<height>
126127
--width=<width>
127-
--material_model=<material-model>
128-
--material_form_model=<material-form-model>
128+
--model=<circularnet-model>
129129
--score=<score>
130130
--search_range=<search-range>
131131
--memory=<memory>
@@ -136,19 +136,34 @@ on Google Cloud:
136136
137137
Replace the following:
138138
139-
- `<path-to-input-bucket>`: The path to [the Cloud Storage input bucket you created](#create-the-cloud-storage-input-and-output-buckets), for example `gs://my-input-bucket/`.
140-
- `<path-to-output-bucket>`: The path to [the Cloud Storage output bucket you created](#create-the-cloud-storage-input-and-output-buckets), for example `gs://my-output-bucket/`.
141-
- `<frames-per-second>`: The rate at which you want to capture images from videos to split videos into frames, for example, 15.
142-
- `<height>`: The height in pixels of the image or video frames that the model expects for prediction, for example, 512.
143-
- `<width>`: The width in pixels of the image or video frames that the model expects for prediction, for example, 1024.
144-
- `<material-model>`: The name of the material model in the Triton inference server that you want to call, for example, `material_resnet_v2_512_1024`.
145-
- `<material-form-model>`: The name of the material form model in the Triton inference server that you want to call, for example, `material_form_resnet_v2_512_1024`.
146-
- `<score>`: The threshold for model prediction, for example, 0.40.
147-
- `<search-range>`: The pixels up to which you want to track an object for object tracking in consecutive frames, for example, 100.
148-
- `<memory>`: The frames up to which you want to track an object, for example, 20.
149-
- `<project-id>`: The ID of your Google Cloud project, for example, `my-project`.
150-
- `<dataset-id>`: The ID that you want to assign to a BigQuery dataset to store prediction results, for example, `circularnet_dataset`.
151-
- `<table-id>`: The ID that you want to assign to a BigQuery table to store prediction results, for example, `circularnet_table`. If the table already exists in your Google Cloud project, the pipeline appends results to that table.
139+
- `<path-to-input-bucket>`: The path to [the Cloud Storage input bucket you
140+
created](#create-the-cloud-storage-input-and-output-buckets), for example
141+
`gs://my-input-bucket/`.
142+
- `<path-to-output-bucket>`: The path to [the Cloud Storage output bucket
143+
you created](#create-the-cloud-storage-input-and-output-buckets), for
144+
example `gs://my-output-bucket/`.
145+
- `<frames-per-second>`: The rate at which you want to capture images from
146+
videos to split videos into frames, for example, `15`.
147+
- `<height>`: The height in pixels of the image or video frames that the
148+
model expects for prediction, for example, `512`.
149+
- `<width>`: The width in pixels of the image or video frames that the
150+
model expects for prediction, for example, `1024`.
151+
- `<circularnet-model>`: The name of the CircularNet model in the Triton
152+
inference server that you want to call, for example,
153+
`Jan2025_ver2_merged_1024_1024`.
154+
- `<score>`: The threshold for model prediction, for example, `0.70`.
155+
- `<search-range>`: The pixels up to which you want to track an object for
156+
object tracking in consecutive frames, for example, `100`.
157+
- `<memory>`: The frames up to which you want to track an object, for
158+
example, `20`.
159+
- `<project-id>`: The ID of your Google Cloud project, for example,
160+
`my-project`.
161+
- `<dataset-id>`: The ID that you want to assign to a BigQuery dataset to
162+
store prediction results, for example, `circularnet_dataset`.
163+
- `<table-id>`: The ID that you want to assign to a BigQuery table to store
164+
prediction results, for example, `circularnet_table`. If the table
165+
already exists in your Google Cloud project, the pipeline appends results
166+
to that table.
152167
153168
**Note:** If your input files are not videos but images, replace
154169
`run_gcp_videos.sh` on the command with `run_gcp_images.sh` and remove the
@@ -160,11 +175,14 @@ on Google Cloud:
160175
1. Run the prediction pipeline:
161176
162177
```
163-
bash run_gcp_videos.sh
178+
bash run_images.sh
164179
```
165180
166-
**Note:** If your input files are not videos but images, replace
167-
`run_gcp_videos.sh` on the command with `run_gcp_images.sh`.
181+
**Note:** If you have a large amount of input files, you can run the
182+
pipeline in a `screen` session in the background without worrying about the
183+
terminal closing down. First, you launch the `screen` session with the
184+
`screen -R client` command. A new session shell launches. Then, run the
185+
`bash run_images.sh` script in the new shell.
168186
169187
The script also creates a `logs` folder inside the `client` folder that saves
170188
the logs with the troubleshooting results and records from the models.

official/projects/waste_identification_ml/circularnet-docs/content/analyze-data/prediction-pipeline-in-edge.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@ in an edge device:
6565
The Vim editor displays the following parameters:
6666
6767
```
68-
--input_directoy=<path-to-input-folder>
69-
--output_directory=<path-to-output-folder> height=<height> width=<width>
70-
--material_model=<material-model> material_form_model=<material-form-model>
71-
--score=<score> search_range=<search-range> memory=<memory>
68+
--input_directory=<path-to-input-folder>
69+
--output_directory=<path-to-output-folder>
70+
--height=<height>
71+
--width=<width>
72+
--model=<circularnet-model>
73+
--score=<score>
74+
--search_range=<search-range>
75+
--memory=<memory>
7276
```
7377
7478
Replace the following:
@@ -78,20 +82,17 @@ in an edge device:
7882
- `<path-to-output-folder>`: The path to the local folder for output image
7983
results in the edge device, for example `/home/images/output_files/`.
8084
- `<height>`: The height in pixels of the image or video frames that the
81-
model expects for prediction, for example, 512.
85+
model expects for prediction, for example, `512`.
8286
- `<width>`: The width in pixels of the image or video frames that the
83-
model expects for prediction, for example, 1024.
84-
- `<material-model>`: The name of the material model in the Triton
87+
model expects for prediction, for example, `1024`.
88+
- `<circularnet-model>`: The name of the CircularNet model in the Triton
8589
inference server that you want to call, for example,
86-
`material_resnet_v2_512_1024`.
87-
- `<material-form-model>`: The name of the material form model in the
88-
Triton inference server that you want to call, for example,
89-
`material_form_resnet_v2_512_1024`.
90-
- `<score>`: The threshold for model prediction, for example, 0.40.
90+
`Jan2025_ver2_merged_1024_1024`.
91+
- `<score>`: The threshold for model prediction, for example, `0.70`.
9192
- `<search-range>`: The pixels up to which you want to track an object for
92-
object tracking in consecutive frames, for example, 100.
93+
object tracking in consecutive frames, for example, `100`.
9394
- `<memory>`: The frames up to which you want to track an object, for
94-
example, 20.
95+
example, `20`.
9596
9697
Save changes and exit the Vim editor. To do this, press the **Esc** key,
9798
type `:wq`, and then press **Enter**.

official/projects/waste_identification_ml/circularnet-docs/content/deploy-cn/before-you-begin.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,40 @@ one of the following options: <br><br>
2121
</li>
2222
<li><p><a href="https://cloud.google.com/compute/docs/gpus/create-gpu-vm-general-purpose">Create a Compute Engine virtual machine (VM) that has attached an NVIDIA T4 GPU</a>. Use the following settings on your VM:</p><br>
2323
<ul>
24-
<li><strong>Machine configuration</strong>: GPUs</li>
25-
<li><strong>GPU type</strong>: NVIDIA T4</li>
26-
<li><strong>Number of GPUs</strong>: 1</li>
27-
<li><strong>Machine type</strong>: n1-standard-8 (8 vCPU, 4 core, 30 GB memory)</li>
28-
<li><strong>Boot disk</strong>: A size of 300 GB</li>
29-
<li><strong>Identity and API access</strong>: Allow full access to all Cloud APIs</li>
30-
<li><strong>Firewall</strong>: Allow HTTP and HTTPS traffic</li>
24+
<li><strong>Machine configuration</strong>:
25+
<ul>
26+
<li><strong>Type</strong>: GPUs</li>
27+
<li><strong>GPU type</strong>: NVIDIA T4</li>
28+
<li><strong>Number of GPUs</strong>: 1</li>
29+
<li><strong>Machine type</strong>: n1-standard-8 (8 vCPU, 4 core, 30 GB memory)</li>
30+
</ul>
31+
</li>
32+
<li><strong>OS and storage</strong>: Click
33+
<b>Change</b> and select the following:
34+
<ul>
35+
<li><strong>Operating system</strong>: Deep Learning on Linux</li>
36+
<li><strong>Version</strong>: Deep Learning VM with
37+
CUDA 11.3 preinstalled. Debian 11, Python 3.10. You can choose
38+
any <i>M</i> number with this configuration, for example, M126.</li>
39+
<li><strong>Boot disk type</strong>: Balanced persistent disk</li>
40+
<li><strong>Size (GB)</strong>: 300 GB</li>
41+
</ul>
42+
</li>
43+
<li><strong>Security</strong>: Navigate to the <b>Identity and API access</b>
44+
section and select the following:
45+
<ul>
46+
<li><strong>Service accounts</strong>:Compute Engine default service account</li>
47+
<li><strong>Access scopes</strong>: Allow full access
48+
to all Cloud APIs</li>
49+
</ul>
50+
</li>
51+
<li><strong>Networking</strong>: Navigate to the <b>Firewall</b>
52+
section and select the following:
53+
<ul>
54+
<li>Allow HTTP traffic</li>
55+
<li>Allow HTTPS traffic</li>
56+
</ul>
57+
</li>
3158
</ul>
3259
<p><strong>Note</strong>: Give your VM a name that is easy to remember and deploy in a region and a zone close to your physical location that allows GPUs.</p><br>
3360
</li>

official/projects/waste_identification_ml/circularnet-docs/content/deploy-cn/start-server.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,18 @@ tool open. For more information, see [Connect to VMs](https://cloud.google.com/c
2121
This script loads as many models as you want at the same time. Later, you can choose which model you want to send your request to from the client side. For more information, see [Prepare and analyze images](/official/projects/waste_identification_ml/circularnet-docs/content/analyze-data/).
2222
2323
For example, when you start analyzing images, you can send them from the
24-
client to the following models in the Triton server you created:
25-
26-
- `material_resnet_v2_512_1024`: shows the material and its subtype using
27-
ResNet for classification on images of 512 x 1024 pixels.
28-
- `material_form_resnet_v2_512_1024`: shows the form of an object, for
29-
example, can or bottle, using ResNet for classification on images of 512
30-
x 1024 pixels.
31-
- `material_mobilenet_v2_512_1024`: shows the material and its subtype
32-
using MobileNet for classification on images of 512 x 1024 pixels.
33-
- `material_form_mobilenet_v2_512_1024`: shows the form of an object, for
34-
example, can or bottle, using MobileNet for classification on images of
35-
512 x 1024 pixels.
24+
client to the following model in the Triton server you created:
25+
26+
- `Jan2025_ver2_merged_1024_1024`: shows the material type and form using
27+
ResNet for classification on images of 1024 x 1024 pixels.
3628
3729
You have finished setting up the Triton inference server. The server keeps
3830
running on the backend and your terminal window lets you run new commands to
39-
interact with it.
31+
interact with it. It takes some time for the server to be up and running.
32+
Wait for the **Status ready** message from the server before launching the
33+
client.
4034
41-
You can confirm the server is running by opening a screen session:
35+
You can confirm the server is running by opening a `screen` session:
4236
4337
1. List the `screen` sessions:
4438
@@ -59,7 +53,7 @@ You can confirm the server is running by opening a screen session:
5953
server. The models must show a `READY` status on the `screen` session when
6054
they are successfully deployed.
6155
62-
1. If you want to exit the screen session without stopping the server, press
56+
1. If you want to exit the `screen` session without stopping the server, press
6357
**Ctrl + A + D** keys.
6458
6559
## What's next
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Retrain CircularNet models
2+
3+
CircularNet's models are initially trained with images captured from Material
4+
Recovery Facilities (MRFs). As a result, these open-source models are
5+
specialized in a limited set of materials, which might not fully align with the
6+
specific materials you collect.
7+
8+
To address your specific use case, you can
9+
retrain the models by utilizing a pipeline built with
10+
[Vertex AI](https://cloud.google.com/vertex-ai/docs). This pipeline is ideal for
11+
analyzing materials from diverse sources, adapting to different business
12+
scenarios, or retraining the model with your own images.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Before you begin
2+
3+
Before starting the retraining process, ensure you meet the following
4+
requirements:
5+
6+
1. [Get access to Google Cloud](https://console.cloud.google.com/).
7+
1. [Open the Google Cloud console](https://cloud.google.com/cloud-console).
8+
1. [Create a project on your Google Cloud account](https://cloud.google.com/resource-manager/docs/creating-managing-projects).
9+
1. Enable the Vertex AI and Cloud Storage APIs to manage programmatic
10+
access and authentication.
11+
12+
To enable APIs, see
13+
[Enabling an API in your Google Cloud project](https://cloud.google.com/endpoints/docs/openapi/enable-api).
14+
15+
1. [Create a Cloud Storage bucket](https://cloud.google.com/storage/docs/creating-buckets)
16+
to store files.
17+
1. Allocate at least four GPUs for the training job on Vertex AI. For more
18+
information, see
19+
[Configure compute resources for custom training](https://cloud.google.com/vertex-ai/docs/training/configure-compute).
20+
1. Set up a service account for Vertex AI, with permissions to perform
21+
training jobs. For more information, see
22+
[Use a custom service account](https://cloud.google.com/vertex-ai/docs/general/custom-service-account).

0 commit comments

Comments
 (0)