浏览代码

fix progress bar not disapearing on error

/pyrception-integration
leopoldo-zugasti 4 年前
当前提交
8077c552
共有 4 个文件被更改,包括 31 次插入10 次删除
  1. 23
      com.unity.perception/Editor/Pyrception/PyrceptionInstaller.cs
  2. 3
      com.unity.perception/Editor/Pyrception/pyrception-utils/docs/pyrception-utils.md
  3. 7
      com.unity.perception/Editor/Pyrception/pyrception-utils/pyrception_utils/preview.py
  4. 8
      com.unity.perception/Editor/Pyrception/pyrception-utils/pyrception_utils/venv.meta

23
com.unity.perception/Editor/Pyrception/PyrceptionInstaller.cs


EditorUtility.DisplayProgressBar("Setting up Pyrception", "Installing virtualenv...", 0 / steps);
int ExitCode = 0;
ExitCode = ExecuteCMD("pip install virtualenv");
if (ExitCode != 0)
ExitCode = ExecuteCMD("pip3 install virtualenv");
if (ExitCode != 0) {
EditorUtility.ClearProgressBar();
}
ExitCode = ExecuteCMD($"virtualenv \"{path}/DataInsightsEnv\"");
ExitCode = ExecuteCMD($"virtualenv -p python3 \"{path}/DataInsightsEnv\"");
if (ExitCode != 0)
if (ExitCode != 0) {
EditorUtility.ClearProgressBar();
}
EditorUtility.DisplayProgressBar("Setting up Pyrception", "Getting pyrception files...", 2f / steps);

ExitCode = ExecuteCMD($"\\cp -r \"{pyrceptionPath}\" \"{path}/DataInsightsEnv/pyrception-util\"");
#endif
if (ExitCode != 0)
if (ExitCode != 0) {
EditorUtility.ClearProgressBar();
}
EditorUtility.DisplayProgressBar("Setting up Pyrception", "Installing pyrception utils...", 2.5f / steps);

ExitCode = ExecuteCMD($"\"{path}/DataInsightsEnv/Scripts/activate\"; cd \"{path}/DataInsightsEnv/pyrception-util\"; pip --no-cache-dir install -e .; deactivate");
ExitCode = ExecuteCMD($"source \"{path}/DataInsightsEnv/Scripts/activate\"; cd \"{path}/DataInsightsEnv/pyrception-util\"; pip --no-cache-dir install -e .; deactivate");
if (ExitCode != 0)
if (ExitCode != 0) {
EditorUtility.ClearProgressBar();
}
EditorUtility.ClearProgressBar();
}

3
com.unity.perception/Editor/Pyrception/pyrception-utils/docs/pyrception-utils.md


<a name="pyrception_utils.preview.draw_image_with_boxes"></a>
#### draw\_image\_with\_boxes
<a name="pyrception_utils.preview.draw_image_with_boxes"></a>
#### draw\_image\_with\_boxes
```python
draw_image_with_boxes(image: Image, classes: Dict, labels: List, boxes: List[List], colors: Dict, header: str, description: str)
```

7
com.unity.perception/Editor/Pyrception/pyrception-utils/pyrception_utils/preview.py


"""
image_draw = ImageDraw(image)
# draw bounding boxes
font = ImageFont.truetype("C:\Windows\Fonts\Arial.ttf", 15)
font = ImageFont.truetype("C:\\Windows\\Fonts\\Arial.ttf", 15)
st.text("There are " + str(len(classes)) + " classes")
label = label - 1
class_name = classes[label]
image_draw.rectangle(box, outline=colors[class_name], width=2)
image_draw.text(

os.path.join(base_dataset_dir, dataset_name)
)
classes = dataset.classes
st.sidebar.selectbox(
"hello", classes
)
image_index = frame_selector_ui(dataset)
image, target = dataset[image_index]
labels = target["labels"]

8
com.unity.perception/Editor/Pyrception/pyrception-utils/pyrception_utils/venv.meta


fileFormatVersion: 2
guid: 4065be85465cb2a4096eb2fc1a263cf4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存