浏览代码

first commit

/main
Mohsen Kamalzadeh 4 年前
当前提交
e0c3d412
共有 13 个文件被更改,包括 2932 次插入25 次删除
  1. 30
      com.unity.perception/Documentation~/Tutorial/Phase1.md
  2. 2
      com.unity.perception/Documentation~/Tutorial/Phase2.md
  3. 22
      com.unity.perception/Documentation~/Tutorial/Phase3.md
  4. 321
      com.unity.perception/Documentation~/HPETutorial/Images/anim_controller_1.png
  5. 362
      com.unity.perception/Documentation~/HPETutorial/Images/assign_controller.png
  6. 1001
      com.unity.perception/Documentation~/HPETutorial/Images/character_transform.png
  7. 279
      com.unity.perception/Documentation~/HPETutorial/Images/project_folders_samples.png
  8. 418
      com.unity.perception/Documentation~/HPETutorial/Images/scenario_empty.png
  9. 435
      com.unity.perception/Documentation~/HPETutorial/Images/select_clip.png
  10. 87
      com.unity.perception/Documentation~/HPETutorial/TUTORIAL.md

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


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!
Steps included this phase of the tutorial:
- [Step 1: Download Unity Editor and Create a New Project](#step-1)
- [Step 2: Download the Perception Package and Import Samples](#step-2)
- [Step 3: Setup a Scene for Your Perception Simulation](#step-3)
- [Step 4: Specify Ground-Truth and Set Up Object Labels](#step-4)
- [Step 5: Set Up Background Randomizers](#step-5)
- [Step 6: Set Up Foreground Randomizers](#step-6)
- [Step 7: Inspect Generated Synthetic Data](#step-7)
- [Step 8: Verify Data Using Dataset Insights](#step-8)
Steps included in this phase of the tutorial:
- [Perception Tutorial](#perception-tutorial)
- [Phase 1: Setup and Basic Randomizations](#phase-1-setup-and-basic-randomizations)
- [<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)
- [<a name="step-2">Step 2: Download the Perception Package and Import Samples</a>](#step-2-download-the-perception-package-and-import-samples)
- [<a name="step-3">Step 3: Setup a Scene for Your Perception Simulation</a>](#step-3-setup-a-scene-for-your-perception-simulation)
- [<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)
- [<a name="step-5">Step 5: Set Up Background Randomizers</a>](#step-5-set-up-background-randomizers)
- [<a name="step-6">Step 6: Set Up Foreground Randomizers</a>](#step-6-set-up-foreground-randomizers)
- [<a name="step-7">Step 7: Inspect Generated Synthetic Data</a>](#step-7-inspect-generated-synthetic-data)
- [<a name="step-8">Step 8: Verify Data Using Dataset Insights</a>](#step-8-verify-data-using-dataset-insights)
### <a name="step-1">Step 1: Download Unity Editor and Create a New Project</a>
* **: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.)

* **: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:
<p align="center">
<img src="Images/forward_renderer.png"/>
<img src="Images/forward_renderer.png" width="800"/>
</p>
* **: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:

* **: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`)
<p align="center">
<img src="Images/camera_prep.png"/>
<img src="Images/camera_prep.png" width = "900"/>
</p>

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:
<p align="center">
<img src="Images/exampleprefab.png"/>
<img src="Images/exampleprefab.png" width="900"/>
</p>
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.

* **: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:
<p align="center">
<img src="Images/jupyter1.png"/>
<img src="Images/jupyter1.png" width="800"/>
</p>
* **: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.

<p align="center">
<img src="Images/jupyter2.png"/>
<img src="Images/jupyter2.png" width="800"/>
</p>
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).

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


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.
Steps included this phase of the tutorial:
Steps included in this phase of the tutorial:
- [Step 1: Build a Lighting Randomizer](#step-1)
- [Step 2: Bundle Data and Logic Inside RandomizerTags](#step-2)

22
com.unity.perception/Documentation~/Tutorial/Phase3.md


In this phase of the tutorial, we will learn how to run our Scene on _**Unity Simulation**_ and analyze the generated dataset using _**Dataset Insights**_. Unity Simulation will allow us to generate a much larger dataset than what is typically plausible on a workstation computer.
Steps included this phase of the tutorial:
- [Step 1: Setup Unity Account, Unity Simulation, and Cloud Project](#step-1)
- [Step 2: Run Project on Unity Simulation](#step-2)
- [Step 3: Keep Track of Your Runs Using the Unity Simulation Command-Line Interface](#step-3)
- [Step 4: Analyze the Dataset using Dataset Insights](#step-4)
Steps included in this phase of the tutorial:
- [Perception Tutorial](#perception-tutorial)
- [Phase 3: Cloud](#phase-3-cloud)
- [<a name="step-1">Step 1: Setup Unity Account, Unity Simulation, and Cloud Project</a>](#step-1-setup-unity-account-unity-simulation-and-cloud-project)
- [<a name="step-2">Step 2: Run Project on Unity Simulation</a>](#step-2-run-project-on-unity-simulation)
- [<a name="step-3">Step 3: Keep Track of Your Runs Using the Unity Simulation Command-Line Interface</a>](#step-3-keep-track-of-your-runs-using-the-unity-simulation-command-line-interface)
- [<a name="step-4">Step 4: Analyze the Dataset using Dataset Insights</a>](#step-4-analyze-the-dataset-using-dataset-insights)
### <a name="step-1">Step 1: Setup Unity Account, Unity Simulation, and Cloud Project</a>

* **:green_circle: Action**: In the window that opens, navigate to the _**Player**_ tab, find the _**Scripting Backend**_ setting (under _**Other Settings**_), and change it to _**Mono**_:
<p align="center">
<img src="Images/mono.png"/>
<img src="Images/mono.png" width="800"/>
</p>
* **:green_circle: Action**: Change _**Fullscreen Mode**_ to _**Windowed**_ and set a width and height of 800 by 600.

* **:green_circle: Action**: In the `data_root = /data/<GUID>` line, the `<GUID>` part will be the location inside your `<download path>` where the data will be downloaded. Therefore, you can just remove it so as to have data downloaded directly to the path you previously specified:
<p align="center">
<img src="Images/di_usim_1.png"/>
<img src="Images/di_usim_1.png" width="900"/>
</p>
The next few lines of code pertain to setting up your notebook for downloading data from Unity Simulation.

Once you have entered all the information, the block of code should look like the screenshot below (the actual values you input will be different):
<p align="center">
<img src="Images/di_usim_2.png"/>
<img src="Images/di_usim_2.png" width="800"/>
</p>

<p align="center">
<img src="Images/di_usim_3.png"/>
<img src="Images/di_usim_3.png" width="800"/>
</p>

<p align="center">
<img src="Images/di_usim_4.png"/>
<img src="Images/di_usim_4.png" width="800"/>
</p>
Follow the rest of the steps inside the notebook to generate a variety of plots and stats. Keep in mind that this notebook is provided just as an example, and you can modify and extend it according to your own needs using the tools provided by the [Dataset Insights framework](https://datasetinsights.readthedocs.io/en/latest/).

321
com.unity.perception/Documentation~/HPETutorial/Images/anim_controller_1.png
文件差异内容过多而无法显示
查看文件

362
com.unity.perception/Documentation~/HPETutorial/Images/assign_controller.png

之前 之后
宽度: 838  |  高度: 782  |  大小: 114 KiB

1001
com.unity.perception/Documentation~/HPETutorial/Images/character_transform.png
文件差异内容过多而无法显示
查看文件

279
com.unity.perception/Documentation~/HPETutorial/Images/project_folders_samples.png

之前 之后
宽度: 1764  |  高度: 588  |  大小: 94 KiB

418
com.unity.perception/Documentation~/HPETutorial/Images/scenario_empty.png

之前 之后
宽度: 932  |  高度: 990  |  大小: 118 KiB

435
com.unity.perception/Documentation~/HPETutorial/Images/select_clip.png

之前 之后
宽度: 1790  |  高度: 998  |  大小: 274 KiB

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


# Human Pose Estimation Tutorial
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.
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.
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!
Steps included in this tutorial:
- [Human Pose Estimation Tutorial](#human-pose-estimation-tutorial)
- [<a name="step-1">Step 1: Import `.fbx` Models and Animations</a>](#step-1-import-fbx-models-and-animations)
- [<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)
### <a name="step-1">Step 1: Import `.fbx` Models and Animations</a>
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).
* **: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`.
We will use this duplicated Scene in this tutorial so that we do not lose our grocery object detection setup from the Perception Tutorial.
* **:green_circle: Action**: If your Scene already contains a Scenario object from the Perception Tutorial, remove all previously added Randomizers from this Scenario.
* **: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.
Your Scenario should now look like this:
<p align="center">
<img src="Images/scenario_empty.png" width="400"/>
</p>
* **: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.
* **:green_circle: Action**: Open _**Package Manager**_ and select the Perception package, which should already be present in the navigation pane to the left side.
* **: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**_.
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:
<p align="center">
<img src="Images/project_folders_samples.png" width="600"/>
</p>
* **:green_circle: Action**: Select all of the asset inside the `Assets/Samples/Perception/<perception-package-version>/Human Pose Estimation/Models and Animations`.
* **:green_circle: Action**: In the _**Inspector**_ tab, navigate to the _**Rig**_ section and set `Animation Type` to `Humanoid`, then click _**Apply**_.
This will make sure all animations included in the sample `.fbx` files are ready to be used on a rigged humanoid model.
### <a name="step-1">Step 2: Set Up a Humanoid Character in a Scene</a>
* **:green_circle: Action**: Drag and drop the file named `Player` into your Scene _**Hierarchy**_.
* **: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.
<p align="center">
<img src="Images/character_transform.png" width="800"/>
</p>
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`.
We will now need to attach an `Animation Controller` to the `Animator` component, in order for our character to animate.
* **:green_circle: Action**: Create a new `Animation Controller` asset in your `Assets` folder and name it `TestAnimationController`.
* **:green_circle: Action**: Double click the new controller to open it. Then right click in the empty area and select _**Create State**_ -> _**Empty**_.
<p align="center">
<img src="Images/anim_controller_1.png" width="600"/>
</p>
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.
* **: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.
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.
* **:green_circle: Action**: Select the animation clip originating from the `TakeObjects.fbx` file, as seen below:
<p align="center">
<img src="Images/select_clip.png" width="600"/>
</p>
* **:green_circle: Action**: Assign `TestAnimationController` to the `Controller` property of the `Player` object's `Animator` component.
<p align="center">
<img src="Images/assign_controller.png" width="400"/>
</p>
s
**[Continue to Phase 1: Setup and Basic Randomizations](Phase1.md)**

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存