Skip to main content

Pytorch Feature Map Extractor

Project description

MapExtrakt

Convolutional Neural Networks Are Beautiful

We all take our eyes for granted, we glance at an object for an instant and our brains can identify with ease. However distorted the information may be, we do a pretty good job at it.

Low light, obscured vision, poor eyesight... There are a myriad of situations where conditions are poor but still we manage to understand what an object it. Context helps, but we humans were created with sight in mind.

Computers have a harder time, but modern advances with convolutional neural networks are making this task a reality and have now surpassed human level accuracy.

Computers are beautiful, neural networks are beautiful. And the maps they create to determine what makes a cat a cat are beautiful.

MapExtrakt makes viewing feature maps a breeze.

Catch a glimpse of how a computer can see.

# load a model 
import torchvision
model = torchvision.models.vgg16(pretrained=True)

#import FeatureExtractor
from MapExtrakt import FeatureExtractor

#load the model and image
fe = FeatureExtractor(model)
fe.set_image("pug.jpg")

#gather maps
img = fe.display_from_map(layer_no=2, out_type="pil", colourize=20, outsize=(1000,500), border=0.03, picture_in_picture=True)
img.save("example_output.jpg")
img

Example Output

View Single Cells At a Time

#gather maps
img = fe.display_from_map(layer_no=2, out_type="pil", colourize=20, outsize=(1000,500), border=0.03, picture_in_picture=False)
img.save("example_output.jpg")
img

Example Output

Export Cells Of Each Layer To Video

#gather maps
fe.write_video(out_size=(1000,500), file_name="output.mp4", 
               write_text=True, picture_in_picture=True, draw_type="both")
MapExtrakt

Installation

It's as easy as PyPI

pip install mapextrakt

or build from source in terminal

git clone https://github.com/lewis-morris/mapextrackt
cd mapextrackt
pip install -e .

More Examples

For more - view the jupyter notebook with extra usage examples.

Examples

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 Distributions

mapextrackt-0.2-py3.7.egg (14.9 kB view details)

Uploaded Source

mapextrackt-0.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file mapextrackt-0.2-py3.7.egg.

File metadata

  • Download URL: mapextrackt-0.2-py3.7.egg
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for mapextrackt-0.2-py3.7.egg
Algorithm Hash digest
SHA256 39e98355de8e4042b07c89d3ddf5b40e70a355833a41db969604622740576297
MD5 506fee9b2b0a50827ca2e986e3597a18
BLAKE2b-256 3836c30446377467d709d29369eb5307a4df1cd66ce03ed0ac40b2e69dee2cdb

See more details on using hashes here.

File details

Details for the file mapextrackt-0.2-py3-none-any.whl.

File metadata

  • Download URL: mapextrackt-0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for mapextrackt-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 66f4267becd38cd12a7efad175115a7486fb019fe7207a17e742f0bc331bc3f7
MD5 a670e140b474246364f52319f00adbdf
BLAKE2b-256 ea0a256334d229af8f886d7c6b135cb76daecb1e5ec0665fdc93335bda9087ca

See more details on using hashes here.

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