Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
activesoull committed Sep 6, 2024
1 parent e25485e commit 4cfa079
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deeplake/api/tests/test_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ def test_stl_mesh(local_ds, stl_mesh_paths):

tensor_data = tensor.data()
tensor_0_data = tensor[0].data()
assert np.all(tensor_data["value"][0] == tensor_0_data["value"])
assert np.all(tensor_data["vertices"][0] == tensor_0_data["vertices"])
5 changes: 4 additions & 1 deletion deeplake/core/compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,10 @@ def read_meta_from_compressed_file(
except Exception as e:
raise CorruptedSampleError(compression, path) from e
elif compression == "stl":
shape, typestr = _read_stl_shape_and_dtype(path)
try:
shape, typestr = _read_stl_shape_and_dtype(file)
except Exception as e:
raise CorruptedSampleError(compression, path) from e

Check warning on line 727 in deeplake/core/compression.py

View check run for this annotation

Codecov / codecov/patch

deeplake/core/compression.py#L726-L727

Added lines #L726 - L727 were not covered by tests
else:
img = Image.open(f) if isfile else Image.open(BytesIO(f)) # type: ignore
shape, typestr = Image._conv_type_shape(img)
Expand Down
15 changes: 14 additions & 1 deletion deeplake/util/object_3d/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,21 @@ def parse_mesh_to_dict(full_arr, sample_info):
first_info = sample_info[0]

if first_info["extension"] == "stl":
print("sample_info", sample_info)
centroids = (
first_info.pop("centroids")
if len(sample_info) == 1
else [info.pop("centroids") for info in sample_info]
)
normals = (
first_info.pop("normals")
if len(sample_info) == 1
else [info.pop("normals") for info in sample_info]
)
return {
"value": full_arr,
"vertices": full_arr,
"centroids": centroids,
"normals": normals,
"sample_info": first_info if len(sample_info) == 1 else sample_info,
}

Expand Down

0 comments on commit 4cfa079

Please sign in to comment.