Skip to content

Commit

Permalink
New Segmentation model
Browse files Browse the repository at this point in the history
Pretraining on artificial data, training on JNatProd + patent data
  • Loading branch information
OBrink authored Feb 15, 2024
2 parents c990944 + 8e2046d commit c4bc839
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
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

0 comments on commit c4bc839

Please sign in to comment.