Skip to main content

neural attention filter

Project description

Neural Filter

Functions

neuralfilter.generate(x, force=False)

  • x: Array with resolution $(H, W, C)$
    The dimension $C$ is recommended as 1.
  • force: If you want to force this operation when the dimension $C$ is higher than 1, set 'force' as True.

neuralfilter.batch_generate(x, force=False)

  • The batch processing mode of 'generate'.
  • x: Array with resolution $(N, H, W, C)$
    The dimension $C$ is recommended as 1.
  • force: If you want to force this operation when the dimension $C$ is higher than 1, set 'force' as True.

batch_generate(x, force=False)

Usage

import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
import neuralfilter

(x_tr, y_tr), (x_te, y_te) = tf.keras.datasets.mnist.load_data()

idx = 1
a = neuralfilter.generate(np.expand_dims(x_tr[idx], axis=-1))

plt.figure(figsize=(9, 3), dpi=100)
plt.subplot(1, 3, 1)
plt.imshow(x_tr[idx], cmap='gray')
plt.xticks([], [])
plt.yticks([], [])

plt.subplot(1, 3, 2)
plt.imshow(a, cmap='jet')
plt.xticks([], [])
plt.yticks([], [])

plt.subplot(1, 3, 3)
plt.imshow(x_tr[idx], cmap='gray')
plt.imshow(a, cmap='jet', alpha=0.5)
plt.xticks([], [])
plt.yticks([], [])

plt.tight_layout()
plt.savefig('sample.png')
plt.show()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

neuralfilter-0.1.9-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page