Skip to content

Commit f3ac72b

Browse files
author
Mohsen Kamalzadeh
committed
first commit
1 parent 8644f82 commit f3ac72b

File tree

11 files changed

+116
-25
lines changed

11 files changed

+116
-25
lines changed
167 KB
Loading
114 KB
Loading
519 KB
Loading
93.5 KB
Loading
118 KB
Loading
274 KB
Loading
5.84 MB
Loading
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Human Pose Estimation Tutorial
2+
3+
In this tutorial, we will walk through the process of importing rigged humanoid models and animations of `.fbx` format into your computer vision data generation project, and using them to produce key-point and pose-estimation ground-truth data. We will use the tools and samples provided in the Perception package.
4+
5+
We strongly recommend you finish [Phase 1 of the Perception Tutorial](../Tutorial/Phase1.md) before continuing with this one, especially if you do not have prior experience with Unity Editor.
6+
7+
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!
8+
9+
Steps included in this tutorial:
10+
- [Human Pose Estimation Tutorial](#human-pose-estimation-tutorial)
11+
- [<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+
14+
### <a name="step-1">Step 1: Import `.fbx` Models and Animations</a>
15+
16+
This tutorial assumes that you have already created a Unity project, installed the Perception package, and set up a Scene with a `Perception Camera` inside. If this is not the case, please follow **steps 1 to 3** of [Phase 1 of the Perception Tutorial](../Tutorial/Phase1.md).
17+
18+
* **:green_circle: Action**: Open the project you created in the Perception Tutorial steps mentioned above. Duplicate `TutorialScene` and name the new Scene `HPE_Scene`. Open `HPE_Scene`.
19+
20+
We will use this duplicated Scene in this tutorial so that we do not lose our grocery object detection setup from the Perception Tutorial.
21+
22+
* **:green_circle: Action**: If your Scene already contains a Scenario object from the Perception Tutorial, remove all previously added Randomizers from this Scenario.
23+
* **:green_circle: Action**: If your Scene does not already contains a Scenario, create an empty GameObject, name it `Simulation Scenario`, and add a `Fixed Length Scenario` component to it.
24+
25+
Your Scenario should now look like this:
26+
27+
<p align="center">
28+
<img src="Images/scenario_empty.png" width="400"/>
29+
</p>
30+
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+
33+
34+
35+
* **:green_circle: Action**: Open _**Package Manager**_ and select the Perception package, which should already be present in the navigation pane to the left side.
36+
* **: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**_.
37+
38+
Once the sample files are imported, they will be placed inside the `Assets/Samples/Perception` folder in your Unity project, as seen in the image below:
39+
40+
<p align="center">
41+
<img src="Images/project_folders_samples.png" width="600"/>
42+
</p>
43+
44+
* **:green_circle: Action**: Select all of the asset inside the `Assets/Samples/Perception/<perception-package-version>/Human Pose Estimation/Models and Animations`.
45+
* **:green_circle: Action**: In the _**Inspector**_ tab, navigate to the _**Rig**_ section and set `Animation Type` to `Humanoid`, then click _**Apply**_.
46+
47+
This will make sure all animations included in the sample `.fbx` files are ready to be used on a rigged humanoid model.
48+
49+
### <a name="step-1">Step 2: Set Up a Humanoid Character in a Scene</a>
50+
51+
* **:green_circle: Action**: Drag and drop the file named `Player` into your Scene _**Hierarchy**_.
52+
* **: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.
53+
54+
<p align="center">
55+
<img src="Images/character_transform.png" width="800"/>
56+
</p>
57+
58+
You will see that the object it already has an `Animator` component attached. This is because we earlier set the `Animation Types` for all files to `Humanoid`.
59+
We will now need to attach an `Animation Controller` to the `Animator` component, in order for our character to animate.
60+
61+
* **:green_circle: Action**: Create a new `Animation Controller` asset in your `Assets` folder and name it `TestAnimationController`.
62+
* **:green_circle: Action**: Double click the new controller to open it. Then right click in the empty area and select _**Create State**_ -> _**Empty**_.
63+
64+
<p align="center">
65+
<img src="Images/anim_controller_1.png" width="600"/>
66+
</p>
67+
68+
This will create a new state and attach the Entry state to it with a new transition edge. This means the controller will always move to this new state as soon as the `Animator` component is awoken. In this example, this will happen when the **** button is pressed and the simulation starts.
69+
70+
* **:green_circle: Action**: Click on the state named `New State`. Then, in the _**Inspector**_ tab click the small circle next to `Motion` to select an animation clip.
71+
72+
In the selector window that pops up, you will see several clips named `Take 001`. These are animation clips that are bundled inside of the sample `.fbx` files you imported into the project.
73+
74+
* **:green_circle: Action**: Select the animation clip originating from the `TakeObjects.fbx` file, as seen below:
75+
76+
<p align="center">
77+
<img src="Images/select_clip.png" width="600"/>
78+
</p>
79+
80+
* **:green_circle: Action**: Assign `TestAnimationController` to the `Controller` property of the `Player` object's `Animator` component.
81+
82+
<p align="center">
83+
<img src="Images/assign_controller.png" width="400"/>
84+
</p>
85+
86+
s
87+
**[Continue to Phase 1: Setup and Basic Randomizations](Phase1.md)**

com.unity.perception/Documentation~/Tutorial/Phase1.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ In this phase of the Perception tutorial, you will start from downloading and in
66

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

9-
Steps included this phase of the tutorial:
10-
- [Step 1: Download Unity Editor and Create a New Project](#step-1)
11-
- [Step 2: Download the Perception Package and Import Samples](#step-2)
12-
- [Step 3: Setup a Scene for Your Perception Simulation](#step-3)
13-
- [Step 4: Specify Ground-Truth and Set Up Object Labels](#step-4)
14-
- [Step 5: Set Up Background Randomizers](#step-5)
15-
- [Step 6: Set Up Foreground Randomizers](#step-6)
16-
- [Step 7: Inspect Generated Synthetic Data](#step-7)
17-
- [Step 8: Verify Data Using Dataset Insights](#step-8)
9+
Steps included in this phase of the tutorial:
10+
- [Perception Tutorial](#perception-tutorial)
11+
- [Phase 1: Setup and Basic Randomizations](#phase-1-setup-and-basic-randomizations)
12+
- [<a name="step-1">Step 1: Download Unity Editor and Create a New Project</a>](#step-1-download-unity-editor-and-create-a-new-project)
13+
- [<a name="step-2">Step 2: Download the Perception Package and Import Samples</a>](#step-2-download-the-perception-package-and-import-samples)
14+
- [<a name="step-3">Step 3: Setup a Scene for Your Perception Simulation</a>](#step-3-setup-a-scene-for-your-perception-simulation)
15+
- [<a name="step-4">Step 4: Specify Ground-Truth and Set Up Object Labels</a>](#step-4-specify-ground-truth-and-set-up-object-labels)
16+
- [<a name="step-5">Step 5: Set Up Background Randomizers</a>](#step-5-set-up-background-randomizers)
17+
- [<a name="step-6">Step 6: Set Up Foreground Randomizers</a>](#step-6-set-up-foreground-randomizers)
18+
- [<a name="step-7">Step 7: Inspect Generated Synthetic Data</a>](#step-7-inspect-generated-synthetic-data)
19+
- [<a name="step-8">Step 8: Verify Data Using Dataset Insights</a>](#step-8-verify-data-using-dataset-insights)
1820

1921
### <a name="step-1">Step 1: Download Unity Editor and Create a New Project</a>
2022
* **:green_circle: Action**: Navigate to [this](https://unity3d.com/get-unity/download/archive) page to download and install the latest version of **Unity Editor 2019.4.x**. (The tutorial has not yet been fully tested on newer versions.)
@@ -65,7 +67,7 @@ Once the sample files are imported, they will be placed inside the `Assets/Sampl
6567
* **:green_circle: Action**: **(For URP projects only)** The _**Project**_ tab contains a search bar; use it to find the file named `ForwardRenderer.asset`, as shown below:
6668

6769
<p align="center">
68-
<img src="Images/forward_renderer.png"/>
70+
<img src="Images/forward_renderer.png" width="800"/>
6971
</p>
7072

7173
* **:green_circle: Action**: **(For URP projects only)** Click on the found file to select it. Then, from the _**Inspector**_ tab of the editor, click on the _**Add Renderer Feature**_ button, and select _**Ground Truth Renderer Feature**_ from the dropdown menu:
@@ -91,7 +93,7 @@ As seen above, the new Scene already contains a camera (`Main Camera`) and a lig
9193
* **:green_circle: Action**: Click on `Main Camera` and in the _**Inspector**_ tab, modify the camera's `Position`, `Rotation`, `Projection` and `Size` to match the screenshot below. (Note that `Size` only becomes available once you set `Projection` to `Orthographic`)
9294

9395
<p align="center">
94-
<img src="Images/camera_prep.png"/>
96+
<img src="Images/camera_prep.png" width = "900"/>
9597
</p>
9698

9799

@@ -177,7 +179,7 @@ In Unity, Prefabs are essentially reusable GameObjects that are stored to disk,
177179
When you open the Prefab asset, you will see the object shown in the Scene tab and its components shown on the right side of the editor, in the _**Inspector**_ tab:
178180

179181
<p align="center">
180-
<img src="Images/exampleprefab.png"/>
182+
<img src="Images/exampleprefab.png" width="900"/>
181183
</p>
182184

183185
The Prefab contains a number of components, including a `Transform`, a `Mesh Filter`, a `Mesh Renderer` and a `Labeling` component (highlighted in the image above). While the first three of these are common Unity components, the fourth one is specific to the Perception package, and is used for assigning labels to objects. You can see here that the Prefab has one label already added, displayed in the list of `Added Labels`. The UI here provides a multitude of ways for you to assign labels to the object. You can either choose to have the asset automatically labeled (by enabling `Use Automatic Labeling`), or add labels manually. In case of automatic labeling, you can choose from a number of labeling schemes, e.g. the asset's name or folder name. If you go the manual route, you can type in labels, add labels from any of the label configurations included in the project, or add from lists of suggested labels based on the Prefab's name and path.
@@ -412,15 +414,15 @@ This will download a Docker image from Unity. If you get an error regarding the
412414
* **:green_circle: Action**: The image is now running on your computer. Open a web browser and navigate to `http://localhost:8888` to open the Jupyter notebook:
413415

414416
<p align="center">
415-
<img src="Images/jupyter1.png"/>
417+
<img src="Images/jupyter1.png" width="800"/>
416418
</p>
417419

418420
* **:green_circle: Action**: To make sure your data is properly mounted, navigate to the `data` folder. If you see the dataset's folders there, we are good to go.
419421
* **:green_circle: Action**: Navigate to the `datasetinsights/notebooks` folder and open `Perception_Statistics.ipynb`.
420422
* **:green_circle: Action**: Once in the notebook, remove the `/<GUID>` part of the `data_root = /data/<GUID>` path. Since the dataset root is already mapped to `/data`, you can use this path directly.
421423

422424
<p align="center">
423-
<img src="Images/jupyter2.png"/>
425+
<img src="Images/jupyter2.png" width="800"/>
424426
</p>
425427

426428
This notebook contains a variety of functions for generating plots, tables, and bounding box images that help you analyze your generated dataset. Certain parts of this notebook are currently not of use to us, such as the code meant for downloading data generated through Unity Simulation (coming later in this tutorial).

com.unity.perception/Documentation~/Tutorial/Phase2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
In Phase 1 of the tutorial, we learned how to use the Randomizers that are bundled with the Perception package to spawn background and foreground objects, and randomize their position, rotation, texture, and hue offset (color). In this phase, we will build a custom light Randomizer for the `Directional Light` object, affecting the light's intensity and color on each Iteration of the Scenario. We will also learn how to include certain data or logic inside a randomized object (such as the light) in order to more explicitly define and restrict its randomization behaviors.
55

6-
Steps included this phase of the tutorial:
6+
Steps included in this phase of the tutorial:
77
- [Step 1: Build a Lighting Randomizer](#step-1)
88
- [Step 2: Bundle Data and Logic Inside RandomizerTags](#step-2)
99

0 commit comments

Comments
 (0)