Trying to work through
eye.py from htm.core’s retina_encoder branch. Really cool stuff about topology allowing neighboring bits to redundantly encode info. It also uses openCV’s ‘contrib’ (community?) optional packages, specifically
cv2.bioinspired for the Retina feature.
Trouble is, I can’t seem to import it correctly. I’ve been copying and piecewise executing the code in a notebook, classes / methods define well enough. When I run the test code:
eye = Eye(output_diameter=200, # create Eye object sparsityParvo=0.2, sparsityMagno=0.02, color=True)
AttributeError Traceback (most recent call last) <ipython-input-38-00d5fc620ff0> in <module> 14 sparsityParvo=0.2, 15 sparsityMagno=0.02, ---> 16 color=True) 17 for img_path in images: 18 eye.reset() <ipython-input-37-1a3bf6127c1a> in __init__(self, output_diameter, sparsityParvo, sparsityMagno, color) 191 192 --> 193 self.retina = cv2.bioinspired.Retina_create( 194 inputSize = (self.retina_diameter, self.retina_diameter), 195 colorMode = color, AttributeError: module 'cv2.cv2' has no attribute 'bioinspired'
I copied the same import code from eye.py:
import cv2 # pip install opencv-contrib-python (after running the pypi install as such), but this gives me the above error.
When I try adding
from cv2 import bioinspired it throws
ImportError: cannot import name 'bioinspired' from 'cv2.cv2' (/Users/mark/opt/anaconda3/lib/python3.7/site-packages/cv2/cv2.cpython-37m-darwin.so)
It seems to be trying to extract bioinspired from that oddly named .so “darwin” file in my site-packages/cv2 (I’ve attached an image of my filetree).
I’ve been checking through the openCV Bioinspired docs, which point me to installing openCV’s extra packages as
pip install opencv-contrib-python after uninstalling any prior openCV packages. This left me with the same issue. Wonder if my install’s simply broken.
Has anyone done any work with the Retina or ChannelEncoders?