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.vgg19(pretrained=True)
#import FeatureExtractor
from MapExtrackt import FeatureExtractor
#load the model and image
fe = FeatureExtractor(model)
fe.set_image("pug.jpg")
#gather maps
fe.display_from_map(layer_no=1)
View Single Cells At a Time
#gather cells
fe.display_from_map(layer_no=2, cell_no=4)
Slice the class to get a range of cells
Layer 2 Cells 0-9
fe[2,0:10]
Or Export Layers To Video
fe.write_video(out_size=(1920,1080), file_name="output.avi",
time_for_layer=60, transition_perc_layer=0.2)
More Examples
For LOTS more - view the jupyter notebook.
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
- Add video parameters such as duration in seconds.
- Clean up code
Author
Created by me, initially to view the outputs on demand.
open to suggestions/ collaborators.
If anyone has any suggestions or requests please send them over I'd be more than happy to consider
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file mapextrackt-0.3-py3.7.egg
.
File metadata
- Download URL: mapextrackt-0.3-py3.7.egg
- Upload date:
- Size: 23.8 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | b419310dac81e1b42fb19f4b291fd43441acbb0a44b8181152d4ad5254368152 |
|
MD5 | 66e09f41816811ec54dc3c8c4bad3ee3 |
|
BLAKE2b-256 | 2a57fe070110e270f532bc4b1e6fed511901e945acc3ac38cc0446b3a29e1ebc |
File details
Details for the file mapextrackt-0.3-py3-none-any.whl
.
File metadata
- Download URL: mapextrackt-0.3-py3-none-any.whl
- Upload date:
- Size: 12.5 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ca394e7acb63491b51f3ef34798cfd96d290ff6e15651824c3a89e40891c0f3 |
|
MD5 | e2fe1d4d8e5cb2523277887eef038639 |
|
BLAKE2b-256 | 4e13496faf24566f2842c4966d54befcab744cd035e766d32834f3659edbd85b |