forked from numenta/nupic.core-legacy
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retina encoder: biological encoder for vision WIP #691
Open
breznak
wants to merge
56
commits into
master
Choose a base branch
from
retina_encoder
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 52 commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
e873102
Retina encoder: initial commit
ctrl-z-9000-times 914d46b
Eye/Retina Encoder - progress.
ctrl-z-9000-times 69d6953
Merge branch 'master_community' into retina_encoder
breznak 3edddad
Retina: fix imports
breznak ce1e68b
Eye: improve documentation
breznak 2eace9e
Eye: remove resulution_factor as argument
breznak 692aec9
Eye: rm arg fovea_scale
breznak b803886
Eye: add argument mode: both/parvo/magno
breznak de65135
Eye: fix parvo:magno cells ratio
breznak e2014ea
Eye: color vs B/W mode
breznak f259ec6
Eye: argument plot=False
breznak 57fd3b0
Eye: remove image_file member
breznak f014438
Eye: remove EyeSensorSampler class as unneeded
breznak 45da86c
Eye: fix parvo/magno split mode
breznak 97e6f57
Revert "Eye: argument plot=False"
breznak 2cc80e1
Eye: comments
breznak 7ae83bf
Eye: compute accepts pos,rot,scale args
breznak 0a908cf
Eye: comments
breznak 99592e9
Eye: improve doc
breznak 61808fa
Eye: fix sparsity of 3D parvo cells
breznak 60c607c
doc
breznak 69f8d93
Eye: self.magno_sdr, parvo_sdr
breznak ef8d0d6
Eye: plot parvo/magno SDR
breznak 10854ac
Merge branch 'master_community' into retina_encoder
breznak cf7488f
Merge branch 'master_community' into retina_encoder
breznak e44d1b1
Merge branch 'master' into retina_encoder
breznak 5bab05e
Merge branch 'master_community' into retina_encoder
breznak 6cb832c
Retina encoder: split to sparsityParvo,Magno
breznak 06a100d
Doc for Channel encoder
breznak af0a85a
Eye: cleanup
breznak e6137c3
Eye: cleanup
breznak ad3e119
Eye: replace PIL with cv2
breznak ff5b47d
Merge branch 'retina_encoder' of https://github.com/htm-community/nup…
breznak d5e3302
Eye: fixes
breznak 32a4e49
Eye: add test
breznak 45eb075
CI: split tests to c++/bindings/python
breznak fc022d6
Merge branch 'master' into retina_encoder
breznak 7f90a1a
Eye: review
breznak 8025d82
Eye: improve test
breznak 4e8b781
Eye: provide dimensions, size
breznak 854b450
MNIST: use Retina image encoder WIP
breznak ede598d
Eye: fix dimensions
breznak f93c904
Eye: fix test
breznak aa3aea8
Eye: fixes for running only one of parvo/magno
breznak 2c94dbb
fixes in mnist + eye
breznak a063676
Eye: improve main example
breznak 80747f5
Eye: doc parameters
breznak 2e50635
Eye: crop ROI to circle
breznak 362ba32
Eye: draw boundary around fovea
breznak fddbcba
Eye: apply rotation before retina processing
breznak 565e69e
Eye: use Retina's log sampling
breznak 116a91a
Eye: run example
breznak be40a5d
Eye: fix scaling
breznak d7c898e
Eye: bigger steps in random walk
breznak b4100a2
eye: plot also the whole scene
breznak 3a6461c
Eye: compute has image is argument
breznak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
""" Unit tests for retina encoder. """ | ||
|
||
import unittest | ||
import os | ||
import numpy as np | ||
|
||
from htm.encoders.eye import Eye | ||
|
||
class EyeEncoderTest(unittest.TestCase): | ||
""" Unit tests for Eye encoder class. """ | ||
ctrl-z-9000-times marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
def testBasicUsage(self): | ||
eye = Eye() | ||
eye.reset() | ||
FILE=os.path.join('py','tests','encoders','ronja_the_cat.jpg') | ||
eye.new_image(FILE) | ||
eye.scale = 0.5 | ||
#eye.center_view() | ||
eye.position = (400,400) | ||
for _ in range(10): | ||
pos,rot,sc = eye.small_random_movement() | ||
(sdrParvo, sdrMagno) = eye.compute(pos,rot,sc) | ||
#eye.plot(delay=500) | ||
print("Sparsity parvo: {}".format(len(eye.parvo_sdr.sparse)/np.product(eye.parvo_sdr.dimensions))) | ||
print("Sparsity magno: {}".format(len(eye.magno_sdr.sparse)/np.product(eye.magno_sdr.dimensions))) | ||
assert(eye.dimensions == (200,200)) | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WIP on MNIST, not yet tuned. I should revert these changes for now.