Skip to content

Commit b600137

Browse files
author
Mohsen Kamalzadeh
committed
some progress
1 parent f3ac72b commit b600137

File tree

4 files changed

+170
-6
lines changed

4 files changed

+170
-6
lines changed
75.4 KB
Loading
53.9 KB
Loading
6.88 MB
Loading

com.unity.perception/Documentation~/HPETutorial/TUTORIAL.md

Lines changed: 170 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,17 @@ We strongly recommend you finish [Phase 1 of the Perception Tutorial](../Tutoria
77
Through-out the tutorial, lines starting with bullet points followed by **":green_circle: Action:"** denote the individual actions you will need to perform in order to progress through the tutorial. This is while non-bulleted lines will provide additional context and explanation around the actions. If in a hurry, you can just follow the actions!
88

99
Steps included in this tutorial:
10+
1011
- [Human Pose Estimation Tutorial](#human-pose-estimation-tutorial)
1112
- [<a name="step-1">Step 1: Import `.fbx` Models and Animations</a>](#step-1-import-fbx-models-and-animations)
12-
- [<a name="step-1">Step 2: Set Up a Humanoid Character in a Scene</a>](#step-2-set-up-a-humanoid-character-in-a-scene)
13+
- [<a name="step-2">Step 2: Set Up a Humanoid Character in a Scene</a>](#step-2-set-up-a-humanoid-character-in-a-scene)
14+
15+
16+
17+
-
18+
- [Step 3: Set Up the Perception Camera for Key Point Annotation](#step-3)
19+
- [Step 4: Configure Human Pose Estimation](#step-4)
20+
- [Step 5: Randomize the Humanoid Character's Animations](#step-5)
1321

1422
### <a name="step-1">Step 1: Import `.fbx` Models and Animations</a>
1523

@@ -28,9 +36,9 @@ Your Scenario should now look like this:
2836
<img src="Images/scenario_empty.png" width="400"/>
2937
</p>
3038

31-
* **:green_circle: Action**: Select `Main Camera` and in the _**Inspector**_ view of the `Perception Camera` component, disable all previously added labelers using the check-mark in front of each.
32-
39+
* **:green_circle: Action**: Select `Main Camera` and in the _**Inspector**_ view of the `Perception Camera` component, **disable** all previously added labelers using the check-mark in front of each. We will be using a new labeler in this tutorial.
3340

41+
We now need to import the sample files required for this tutorial.
3442

3543
* **:green_circle: Action**: Open _**Package Manager**_ and select the Perception package, which should already be present in the navigation pane to the left side.
3644
* **:green_circle: Action**: From the list of ***Samples*** for the Perception package, click on the ***Import into Project*** button for the sample bundle named _**Human Pose Estimation**_.
@@ -46,7 +54,7 @@ Once the sample files are imported, they will be placed inside the `Assets/Sampl
4654

4755
This will make sure all animations included in the sample `.fbx` files are ready to be used on a rigged humanoid model.
4856

49-
### <a name="step-1">Step 2: Set Up a Humanoid Character in a Scene</a>
57+
### <a name="step-2">Step 2: Set Up a Humanoid Character in a Scene</a>
5058

5159
* **:green_circle: Action**: Drag and drop the file named `Player` into your Scene _**Hierarchy**_.
5260
* **:green_circle: Action**: Select the new `Player` object in the Scene and in the _**Inspector**_ tab set its transform's position and rotation according to the image below to make the character face the camera.
@@ -83,5 +91,161 @@ In the selector window that pops up, you will see several clips named `Take 001`
8391
<img src="Images/assign_controller.png" width="400"/>
8492
</p>
8593

86-
s
87-
**[Continue to Phase 1: Setup and Basic Randomizations](Phase1.md)**
94+
If you run the simulation now you will see the character going through a series of three animations for picking up a hypothetical object as seen in the GIF below. This is one complete run of the `TakeObjects` animation clip we selected earlier.
95+
96+
<p align="center">
97+
<img src="Images/take_objects.gif" width="600"/>
98+
</p>
99+
100+
101+
### <a name="step-3">Step 3: Set Up the Perception Camera for Key Point Annotation</a>
102+
103+
Now that we have our character performing animations, let's modify our `Perception Camera` to report the character's key points in the output dataset, updating frame by frame as they animate.
104+
105+
* **:green_circle: Action**: Add a `KeyPointLabeler` to the list of labelers in `Perception Camera`.
106+
107+
Similar to the labelers we used in the Perception Tutorial, we will need a label configuration for this new labeler.
108+
109+
* **:green_circle: Action**: In the _**Project**_ tab, right-click the `Assets` folder, then click _**Create -> Perception -> Id Label Config**_. Name the new asset `HPE_IdLabelConfig`.
110+
* **:green_circle: Action**: Add the label `MyCharacter` to the newly created config.
111+
112+
> :information_source: You can use any label string, as long as you assign the same label to the `Player` object in the next step.
113+
114+
* **:green_circle: Action**: Add a `Labeling` component to the `Player` object in the Scene.
115+
* **:green_circle: Action**: In the _**Inspector**_ UI for this new `Labeling` component, expand `HPE_IdLabelConfig` and click _**Add to Labels** on `MyCharacter`.
116+
117+
<p align="center">
118+
<img src="Images/add_label_from_config.png" width="400"/>
119+
</p>
120+
121+
* **:green_circle: Action**: Return to `Perception Camera` and assign `HPE_IdLabelConfig` to the `KeyPointLabeler`'s label configuration property.
122+
123+
The labelers should now look like the image below:
124+
125+
<p align="center">
126+
<img src="Images/keypoint_labeler.png" width="500"/>
127+
</p>
128+
129+
Note the `CocoKeyPointTemplate` asset that is already assigned as the `Active Template`. This template will tell the labeler how to map default Unity rig joints to human joint labels in the popular COCO dataset, so that the output of the labeler can be easily converted to COCO format. Later in this tutorial, we will learn how to add more joints to our character and how to customize joint mapping templates.
130+
131+
<p align="center">
132+
<img src="Images/take_objects_keypoints.gif" width="600"/>
133+
</p>
134+
135+
You can now check out the output dataset to see what the annotations look like. To do this, click the _**Show Folder**_ button in the `Perception Camera` UI, then navigate inside to the dataset folder to find the `captures_000.json` file. Here is an example annotation for the first frame of our test-case here:
136+
137+
138+
```json
139+
"pose": "unset",
140+
"keypoints": [
141+
{
142+
"index": 0,
143+
"x": 0.0,
144+
"y": 0.0,
145+
"state": 0
146+
},
147+
{
148+
"index": 1,
149+
"x": 649.05615234375,
150+
"y": 300.65264892578125,
151+
"state": 2
152+
},
153+
{
154+
"index": 2,
155+
"x": 594.4522705078125,
156+
"y": 335.8978271484375,
157+
"state": 2
158+
},
159+
{
160+
"index": 3,
161+
"x": 492.46444702148438,
162+
"y": 335.72491455078125,
163+
"state": 2
164+
},
165+
{
166+
"index": 4,
167+
"x": 404.89456176757813,
168+
"y": 335.57647705078125,
169+
"state": 2
170+
},
171+
{
172+
"index": 5,
173+
"x": 705.89404296875,
174+
"y": 335.897705078125,
175+
"state": 2
176+
},
177+
{
178+
"index": 6,
179+
"x": 807.74688720703125,
180+
"y": 335.7244873046875,
181+
"state": 2
182+
},
183+
{
184+
"index": 7,
185+
"x": 895.1993408203125,
186+
"y": 335.57574462890625,
187+
"state": 2
188+
},
189+
{
190+
"index": 8,
191+
"x": 612.51654052734375,
192+
"y": 509.065185546875,
193+
"state": 2
194+
},
195+
{
196+
"index": 9,
197+
"x": 608.50006103515625,
198+
"y": 647.0631103515625,
199+
"state": 2
200+
},
201+
{
202+
"index": 10,
203+
"x": 611.7791748046875,
204+
"y": 797.7828369140625,
205+
"state": 2
206+
},
207+
{
208+
"index": 11,
209+
"x": 682.175048828125,
210+
"y": 509.06524658203125,
211+
"state": 2
212+
},
213+
{
214+
"index": 12,
215+
"x": 683.1016845703125,
216+
"y": 649.64434814453125,
217+
"state": 2
218+
},
219+
{
220+
"index": 13,
221+
"x": 686.3271484375,
222+
"y": 804.203857421875,
223+
"state": 2
224+
},
225+
{
226+
"index": 14,
227+
"x": 628.012939453125,
228+
"y": 237.50531005859375,
229+
"state": 2
230+
},
231+
{
232+
"index": 15,
233+
"x": 660.023193359375,
234+
"y": 237.50543212890625,
235+
"state": 2
236+
},
237+
{
238+
"index": 16,
239+
"x": 0.0,
240+
"y": 0.0,
241+
"state": 0
242+
},
243+
{
244+
"index": 17,
245+
"x": 0.0,
246+
"y": 0.0,
247+
"state": 0
248+
}
249+
]
250+
}
251+
```

0 commit comments

Comments
 (0)