def show_sample( test_A, test_B ): figure_A = numpy.stack([ test_A, autoencoder_A.predict( test_A ), autoencoder_B.predict( test_A ), ], axis=1 ) figure_B = numpy.stack([ test_B, autoencoder_B.predict( test_B ), autoencoder_A.predict( test_B ), ], axis=1 ) figure = numpy.concatenate( [ figure_A, figure_B ], axis=0 ) figure = figure.reshape( (4,7) + figure.shape[1:] ) figure = stack_images( figure ) figure = numpy.clip( figure * 255, 0, 255 ).astype('uint8') cv2.imwrite( '_sample.jpg', figure )
def show_sample(self, test_A, test_B): figure_A = numpy.stack([ test_A, autoencoder_A.predict(test_A), autoencoder_B.predict(test_A), ], axis=1) figure_B = numpy.stack([ test_B, autoencoder_B.predict(test_B), autoencoder_A.predict(test_B), ], axis=1) figure = numpy.concatenate([figure_A, figure_B], axis=0) figure = figure.reshape((4, 7) + figure.shape[1:]) figure = stack_images(figure) figure = numpy.clip(figure * 255, 0, 255).astype('uint8') if self.arguments.preview is True: cv2.imshow('', figure) if not self.arguments.preview or self.arguments.write_image: cv2.imwrite('_sample.jpg', figure)