PyOPIA 2.5.12__tar.gz → 2.5.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyopia-2.5.12 → pyopia-2.5.13}/PKG-INFO +1 -1
- pyopia-2.5.13/pyopia/__init__.py +1 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/classify.py +7 -8
- pyopia-2.5.12/pyopia/__init__.py +0 -1
- {pyopia-2.5.12 → pyopia-2.5.13}/LICENSE +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/README.md +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/background.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/cli.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/exampledata.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/instrument/__init__.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/instrument/common.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/instrument/holo.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/instrument/silcam.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/instrument/uvp.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/io.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/pipeline.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/plotting.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/process.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/simulator/__init__.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/simulator/silcam.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/statistics.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/tests/__init__.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/tests/test_classify.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/tests/test_notebooks.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyopia/tests/test_pipeline.py +0 -0
- {pyopia-2.5.12 → pyopia-2.5.13}/pyproject.toml +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '2.5.13'
|
|
@@ -5,7 +5,6 @@ Module containing tools for classifying particle ROIs
|
|
|
5
5
|
import os
|
|
6
6
|
import numpy as np
|
|
7
7
|
import pandas as pd
|
|
8
|
-
|
|
9
8
|
import logging
|
|
10
9
|
logger = logging.getLogger()
|
|
11
10
|
|
|
@@ -77,6 +76,10 @@ class Classify():
|
|
|
77
76
|
self.model_path = model_path
|
|
78
77
|
self.load_model()
|
|
79
78
|
|
|
79
|
+
# Get config for image resizing from the model
|
|
80
|
+
_, self.img_height, self.img_width, _ = self.model.get_config()['layers'][0]['config']['batch_shape']
|
|
81
|
+
self.pad_to_aspect_ratio = getattr(self.model.layers[0], 'pad_to_aspect_ratio', False)
|
|
82
|
+
|
|
80
83
|
# Enable this to perform whitebalance correction in the preprocessing step
|
|
81
84
|
self.correct_whitebalance = False
|
|
82
85
|
|
|
@@ -134,7 +137,7 @@ class Classify():
|
|
|
134
137
|
A particle ROI with range 0.-255., corrected and preprocessed, ready for prediction
|
|
135
138
|
'''
|
|
136
139
|
|
|
137
|
-
whitebalanced =
|
|
140
|
+
whitebalanced = img_input.astype(np.float64)
|
|
138
141
|
|
|
139
142
|
# Do white-balance correction as a per-channel histogram shift
|
|
140
143
|
if self.correct_whitebalance:
|
|
@@ -150,14 +153,10 @@ class Classify():
|
|
|
150
153
|
# which loads images in 0-255 range
|
|
151
154
|
img = keras.utils.img_to_array(whitebalanced * 255)
|
|
152
155
|
|
|
153
|
-
# Get config for image resizing from the model
|
|
154
|
-
_, img_height, img_width, _ = self.model.get_config()['layers'][0]['config']['batch_shape']
|
|
155
|
-
pad_to_aspect_ratio = getattr(self.model.layers[0], 'pad_to_aspect_ratio', False)
|
|
156
|
-
|
|
157
156
|
# resize to match the dimentions expected by the network
|
|
158
|
-
img = tf.image.resize(img, [img_height, img_width],
|
|
157
|
+
img = tf.image.resize(img, [self.img_height, self.img_width],
|
|
159
158
|
method=tf.image.ResizeMethod.BILINEAR,
|
|
160
|
-
preserve_aspect_ratio=pad_to_aspect_ratio)
|
|
159
|
+
preserve_aspect_ratio=self.pad_to_aspect_ratio)
|
|
161
160
|
|
|
162
161
|
img_array = tf.keras.utils.img_to_array(img)
|
|
163
162
|
img_preprocessed = tf.expand_dims(img_array, 0) # Create a batch
|
pyopia-2.5.12/pyopia/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '2.5.12'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|