Skip to content

Commit

Permalink
fix cache; specify gl version to resolve seg fault for github action
Browse files Browse the repository at this point in the history
  • Loading branch information
petrikvladimir committed Jun 23, 2023
1 parent 4aaf9b4 commit 7aa60f8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 44 deletions.
34 changes: 1 addition & 33 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
shell: bash

- name: Cashing of the happypose installation
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ env.CONDA }}/envs
key:
Expand Down Expand Up @@ -67,37 +67,5 @@ jobs:
- name: Run tests
run: |
pip install pytest coverage
python tests/test_renderer_panda3d.py
coverage run -m pytest tests
- uses: codecov/codecov-action@v3

# - uses: conda-incubator/setup-miniconda@v2
# with:
# activate-environment: happypose
# environment-file: environment.yml
# python-version: ${{ matrix.python-version }}
# auto-activate-base: false
# miniconda-version: 'latest'
# - name: Install happypose
# run: |
# cd happypose/pose_estimators/cosypose
# python setup.py install
# cd ../../..
# pip install -e .
#
# - name: Install bop toolkit (temporal fix)
# run: |
# mkdir libs
# cd libs
# git clone https://github.com/ylabbe/bop_toolkit/ -b dataset-tools
# cd bop_toolkit
# sed 's/==.*$//' requirements.txt > req_nover.txt
# pip install -r req_nover.txt -e .

# - name: Run tests
# run: |
# pip install pytest coverage
# python tests/test_renderer_panda3d.py
# coverage run -m pytest tests
# - uses: codecov/codecov-action@v3

8 changes: 1 addition & 7 deletions happypose/toolbox/renderer/panda3d_scene_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def __init__(self) -> None:
p3d.core.load_prc_file_data(
__file__,
"load-display pandagl\n"
"gl-version 3 2\n"
"notify-level-assimp fatal\n"
"notify-level-egldisplay fatal\n"
"notify-level-glgsg fatal\n"
Expand Down Expand Up @@ -102,10 +103,6 @@ def __init__(self) -> None:
self.render.set_antialias(p3d.core.AntialiasAttrib.MAuto)
self.render.set_two_sided(True)

def finalizeExit(self):
"""Overwrite to not call sys.exit()"""
pass


def make_scene_lights(
ambient_light_color: RgbaColor = (0.1, 0.1, 0.1, 1.0),
Expand Down Expand Up @@ -175,9 +172,6 @@ def __init__(
for label in tqdm(preload_labels, disable=not verbose):
self.get_object_node(label)

def __del__(self):
self._app.destroy()

def create_new_camera(self, resolution: Resolution) -> Panda3dCamera:
idx = sum([len(x) for x in self._cameras_pool.values()])
cam = Panda3dCamera.create(f"camera={idx}", resolution=resolution, app=self._app)
Expand Down
4 changes: 0 additions & 4 deletions tests/test_renderer_panda3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,17 @@ def test_simple_render(self):
color=(1.0, 1, 1, 1),
),
]
print('rendering start')
renderings = renderer.render_scene(object_datas, camera_datas, light_datas)
# import matplotlib.pyplot as plt
# fig, ax = plt.subplots(1, 1, squeeze=True) # type: plt.Figure, plt.Axes
# ax.imshow(renderings[0].rgb)
# plt.show()
print('rendering done')

self.assertEqual(len(renderings), 1)
rgb = renderings[0].rgb

assert_equal(rgb[rgb.shape[0] // 2, rgb.shape[1] // 2], (255, 0, 0))
assert_equal(rgb[0, 0], (0, 0, 0))
print('test done')



if __name__ == "__main__":
Expand Down

0 comments on commit 7aa60f8

Please sign in to comment.