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

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file neuralfilter-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: neuralfilter-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.12

File hashes

Hashes for neuralfilter-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 1c2a1b58959ec6944024bafb633382032001a69b0455aefc8ab30022267741ae
MD5 d1ce3d718719e53fac35eb70cb1cb5a8
BLAKE2b-256 3b6c9ce607d0e0d4fa7c7977527d572192c2c47798ef75a4f0bd94bdbf7c0f4e

See more details on using hashes here.

Supported by

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