Skip to content

Commit

Permalink
trying to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
cpavelchek committed Jun 27, 2020
1 parent 5f5f330 commit eea5aea
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions redis_consumer/consumers/mibi_consumer.py
Expand Up @@ -108,8 +108,9 @@ def _consume(self, redis_hash):
self.logger.debug('Image shape after scaling is: %s', image.shape)

# Preprocess image
if image.ndim < 4:
image = np.expand_dims(image, 0)
# Image must be of shape (batch, x, y, channels), but scaling
# eliminates batch dim, so we recreate it here
image = np.expand_dims(image, 0)
image = processing.phase_preprocess(image)
image = np.squeeze(image)
self.logger.debug('Shape after phase_preprocess is: %s', image.shape)
Expand All @@ -118,15 +119,20 @@ def _consume(self, redis_hash):
self.update_key(redis_hash, {'status': 'predicting'})
image = self.predict(image, model_name, model_version)

print('image type is: ', type(image))
if isinstance(image, list):
print('Predictions are as list, length is: ', len(image))

else:
print('Predictions are instead type: ', type(image))
print('Size of ', type(image), ' is: ', image.shape)

# Post-process model results
self.update_key(redis_hash, {'status': 'post-processing'})
if isinstance(image, list):
if len(image) == 4:
image = np.squeeze(processing.deep_watershed_mibi(image))
else:
self.logger.warning('Output length was %s, should have been 4')
self.logger.warning('Output length was %s, expected 4')
image = np.asarray(image)
else:
image = image
Expand Down

0 comments on commit eea5aea

Please sign in to comment.