Skip to content

Commit

Permalink
Switch out HOG implementation to my 'fasthog' library
Browse files Browse the repository at this point in the history
  • Loading branch information
blackwer committed Apr 10, 2023
1 parent 1082d7a commit d265b0d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 774 deletions.
34 changes: 7 additions & 27 deletions ManifoldEM/CC/ComputeMeasureEdgeAll.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from ManifoldEM import p, myio, set_params
from ManifoldEM.CC.OpticalFlowMovie import SelectFlowVec
from ManifoldEM.CC.hogHistogram import histogram_from_gradients
from fasthog import hog_from_gradient as histogram_from_gradients


@contextmanager
Expand All @@ -29,24 +29,14 @@ def poolcontext(*args, **kwargs):


def HOGOpticalFlowPy(flowVec, hogFigfile):
cellSize = (4, 4) # this is actually the block size
cellSize = (4, 4)
cellsPerBlock = (2, 2)
visualize = False
nbins = 9
signedOrientation = True
histogramNormalize = True
flatten = False
sameSize = True
n_bins = 9
signedOrientation = True # FIXME: Add to FASTHOG (set by default)

hog_params = dict(cell_size=cellSize,
cells_per_block=cellsPerBlock,
visualise=visualize,
nbins=nbins,
signed_orientation=signedOrientation,
normalise=histogramNormalize,
flatten=flatten,
same_size=sameSize)

n_bins=n_bins)
VxDim = flowVec['Vx'].shape
if len(VxDim) > 2:
VxStackDim = VxDim[2]
Expand All @@ -60,12 +50,7 @@ def HOGOpticalFlowPy(flowVec, hogFigfile):
gy,
cell_size=cellSize,
cells_per_block=cellsPerBlock,
visualise=visualize,
nbins=nbins,
signed_orientation=signedOrientation,
normalise=histogramNormalize,
flatten=flatten,
same_size=sameSize)
n_bins=n_bins)
tempH.append(tH)

H = np.array(tempH)
Expand All @@ -80,12 +65,7 @@ def HOGOpticalFlowPy(flowVec, hogFigfile):
gy,
cell_size=cellSize,
cells_per_block=cellsPerBlock,
visualise=visualize,
nbins=nbins,
signed_orientation=signedOrientation,
normalise=histogramNormalize,
flatten=flatten,
same_size=sameSize)
n_bins=n_bins)

return H, hog_params

Expand Down
Loading

0 comments on commit d265b0d

Please sign in to comment.