Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #108

Merged
merged 3 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion decimer_segmentation/decimer_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def load_model() -> modellib.MaskRCNN:
# Download trained weights if needed
if not os.path.exists(model_path):
print("Downloading model weights...")
url = "https://zenodo.org/records/10142866/files/mask_rcnn_molecule.h5?download=1"
url = "https://zenodo.org/record/10663579/files/mask_rcnn_molecule.h5?download=1"
req = requests.get(url, allow_redirects=True)
with open(model_path, "wb") as model_file:
model_file.write(req.content)
Expand Down
4 changes: 1 addition & 3 deletions tests/test_mask_expansion.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np

from decimer_segmentation.complete_structure import (
binarize_image,
get_seeds,
Expand All @@ -7,15 +8,13 @@
detect_horizontal_and_vertical_lines,
)


def test_binarize_image():
test_image_array = np.array([[255, 255, 255],[0, 0, 0],[255, 255, 255]])
test_threshold = "otsu"
expected_result = np.array([True, False, True])
actual_result = binarize_image(test_image_array, test_threshold)
assert np.array_equal(expected_result, actual_result)


def test_get_seeds():
test_image_array = np.array([[0, 1, 0],[1, 0, 1],[0, 1, 0]])
test_mask_array = np.ones(test_image_array.shape)
Expand All @@ -25,7 +24,6 @@ def test_get_seeds():
for index in range(len(expected_result)):
assert expected_result[index] == actual_result[index]


def test_expand_masks():
test_image_array = np.array([(False, False, True, True, True)])
test_seed_pixels = [(2, 0)]
Expand Down
Loading