Skip to content

Commit

Permalink
Improve code style
Browse files Browse the repository at this point in the history
  • Loading branch information
ppizarror committed Aug 28, 2024
1 parent 17284d7 commit 34843d1
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions MLStructFP_benchmarks/ml/model/architectures/_fp_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def _custom_save_session(self, filename: str, data: dict) -> None:
if self._get_session_data('train_samples') is None:
self._register_session_data('train_samples', os.path.join(_PATH_SESSION, f'samples_{random.getrandbits(64)}.npz'))
samples_f = self._get_session_data('train_samples')
# noinspection PyTypeChecker
np.savez_compressed(samples_f, data=self._samples)

def _custom_load_session(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def __init__(
:param image_shape: Input shape
:param kwargs: Optional keyword arguments
"""

# Create base model
# noinspection PyArgumentList
BaseFloorPhotoModel.__init__(self, data, name, image_shape, **kwargs.get('path', ''))
self._output_layers = ['discriminator', 'generator']

Expand Down
6 changes: 3 additions & 3 deletions MLStructFP_benchmarks/ml/model/core/_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2176,12 +2176,12 @@ def load_session(
assert data['version'] == _SESSION_EXPORT_VERSION, _ver

# Assert object class
_class = 'Session model class <{0}> is different than current ' \
_class = 'Session model class <{0}> is different from current ' \
'model class <{1}>'.format(data['class'], self.__class__.__name__)
assert data['class'] == self.__class__.__name__, _class

# Assert class version
_classv = 'Session class version <{0}> is different than current ' \
_classv = 'Session class version <{0}> is different from current ' \
'model class version <{1}>'.format(data['class_version'], self._version)
assert data['class_version'] == self._version, _classv

Expand Down Expand Up @@ -2267,7 +2267,7 @@ def load_session(
current_compile_config: Dict[str, Any] = self._get_compile_config()
if current_compile_config != data['compile_config'] and len(current_compile_config.keys()) > 0 \
and self._check_compilation:
_compile_msg = 'Compile configuration from session is different than the current model'
_compile_msg = 'Compile configuration from session is different from the current model'
# warnings.warn(_compile_msg)
self._print(_compile_msg + ':')
for k in current_compile_config.keys():
Expand Down
1 change: 1 addition & 0 deletions MLStructFP_benchmarks/ml/model/core/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import tensorflow as tf


# noinspection PyTypeChecker
def load_model_from_session(
filename: str,
enable_memory_growth: Optional[bool] = None,
Expand Down
2 changes: 1 addition & 1 deletion MLStructFP_benchmarks/ml/utils/callbacks/_tensorboardv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def _configure_embeddings(self) -> None:
from tensorboard.plugins import projector
except ImportError:
raise ImportError('Failed to import TensorBoard. Please make sure that '
'TensorBoard integration is complete."')
'TensorBoard integration is complete.')
config = projector.ProjectorConfig()
for layer in self.model.layers:
if isinstance(layer, embeddings.Embedding):
Expand Down
2 changes: 1 addition & 1 deletion MLStructFP_benchmarks/utils/_fp_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _process_floor(
:param floor: Floor to process
:param kwargs: Keyword optional arguments
:param rotation_angles: Which rotation angles are applied to the floor plan
:returns: Number of (added, ignored) patches
:return: Number of (added, ignored) patches
"""
if floor.id in self._processed_floor:
raise ValueError(f'Floor ID {floor.id} already processed')
Expand Down
2 changes: 1 addition & 1 deletion dvec/util_files/data/transforms/degradation_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def do_degrade(self, image):
:param image: input image
:type image: numpy.ndarray of shape [h, w] with values in range [0, 255)
:returns: degraded image
:return: degraded image
:rtype: numpy.ndarray of shape [h, w] with values in range [0, 255)
"""
degradations = self.degradations[np.random.choice(len(self.degradations))]
Expand Down

0 comments on commit 34843d1

Please sign in to comment.