Skip to main content

Pytorch Feature Map Extractor

Project description

MapExtrackt

Release

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 is. 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.

Computers are amazing, the neural networks and maps they create are beautiful.

Why not have an explore?


MapExtrakt makes viewing feature maps a breeze.

Catch a glimpse of how a computer can see.

MapExtrakt Usage


First import your model

import torchvision
model = torchvision.models.vgg19(pretrained=True)

Import MapExtract's Feature Extractor and load in the model

from MapExtrackt import FeatureExtractor
fe = FeatureExtractor(model)

Set image to be analysed - input can be PIL Image, Numpy array or filepath. We are using the path

fe.set_image("pug.jpg")

View Layers

fe.display_from_map(layer_no=1)

Example Output

View Single Cells At a Time

fe.display_from_map(layer_no=2, cell_no=4)

Example Output

Slice the class to get a range of cells (Layer 2 Cells 0-9)

fe[2,0:10]

Example Output

Or Export Layers To Video

fe.write_video(out_size=(1200,800), file_name="output.avi", time_for_layer=60, transition_perc_layer=0.2)
MapExtrackt

More Examples

For LOTS more - view the jupyter notebook.

Examples


Installation

It's as easy as PyPI

pip install mapextrackt

or build from source in terminal

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

Todo List

  • Add the ability to slice the class i.e FeatureExtractor[1,3]
  • Show parameters on the image
  • Fix video generation
  • Enable individual cells to be added to video
  • Add video parameters such as duration in seconds.
  • Clean up code
  • Make speed improvements

Author

Created by me, initially to view the outputs for my own pleasure.

If anyone has any suggestions or requests please send them over I'd be more than happy to consider.

lewis.morris@gmail.com

Project details


Download files

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

Source Distribution

mapextrackt-0.4.8.5.tar.gz (11.7 kB view details)

Uploaded Source

Built Distributions

mapextrackt-0.4.8.5-py3.7.egg (25.2 kB view details)

Uploaded Source

mapextrackt-0.4.8.5-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file mapextrackt-0.4.8.5.tar.gz.

File metadata

  • Download URL: mapextrackt-0.4.8.5.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2

File hashes

Hashes for mapextrackt-0.4.8.5.tar.gz
Algorithm Hash digest
SHA256 3b45b664555200ba0da5b8ac09e0df3ea2742c212e3762d72a14f1576bf0a67d
MD5 d807fd56696ec533e82790524eecf869
BLAKE2b-256 91573f970a25edadae90094890bd979cc91afefc4f71bc7fbf8b563971e818b2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mapextrackt-0.4.8.5-py3.7.egg
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2

File hashes

Hashes for mapextrackt-0.4.8.5-py3.7.egg
Algorithm Hash digest
SHA256 f396397ed6d4ffb6860a446938cd15a59c67e976543d9ee6b5a48d65563bb624
MD5 af0ec3eb9726ce3c8dd738ad0a304dd6
BLAKE2b-256 28e22f5b2d0293bd7bcccccdf4690a5af30face20facb9681cc1bc01966a99bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mapextrackt-0.4.8.5-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2

File hashes

Hashes for mapextrackt-0.4.8.5-py3-none-any.whl
Algorithm Hash digest
SHA256 45720b5ebeee319a7873fd44cd3786a4192ec2e1ad7d5778bd8884488f2d297a
MD5 91449f3e76bff0760a4984321386d59d
BLAKE2b-256 d17c0a3d8edd274ea6ef364c5af40f9be0791072f93fa32fe690306d2633e117

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