Code Monkey home page Code Monkey logo

meanshift_py's People

Contributors

awangga avatar jembezmamy avatar massens avatar mattnedrich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meanshift_py's Issues

About running images in RGB

Hi mat,

Can you add some instructions about how to pass a 3D dimension image like RGB into the function? Besides, it looks when the size of image increase, you have to wait lots of time, so is there any recommended iteration number for breaking from the loop?

Best,

Haodong

Multivariate gaussian kernel

Hi Matt!

First of all, thank you very much for this implementation, I found it very useful along with the blog post! :)

I did an implementation of a multivariate gaussian kernel, instead of a univariate gaussian kernel (as the one implemented). I needed for image processing, to find fixation points from raw gaze data.

I was wondering if you would be interested in a pull request with the implementation of the multivariate gaussian kernel.

Cheers,
Marc

PD: I wasn't sure where to put this messege, sorry if it shouldn't go in Issues ^^'

algorithm mistake

The Gaussian Kernal algorithm in your code has a mistake:

def gaussian_kernel(distance, bandwidth):
    euclidean_distance = np.sqrt(((distance)**2).sum(axis=1))
    val = (1/(bandwidth*math.sqrt(2*math.pi))) * np.exp(-0.5*((euclidean_distance / bandwidth))**2)
    return 

Where val = (1/(bandwidth*math.sqrt(2*math.pi))) * np.exp(-0.5*((euclidean_distance / bandwidth))**2) should be
val = (1/(bandwidth*math.sqrt(2*math.pi))) * np.exp(-0.5*((euclidean_distance / bandwidth)**2)).

-0.5*((euclidean_distance / bandwidth))**2 -> -0.5*((euclidean_distance / bandwidth)**2)

Reference

Mean Shift to Generate Images

I would like to generate images (like "ms_2d_bw_.8.gif"), but I don't see anything image related in the source code.
Where/how did you get those images?

Absolute imports or PIP package?

Hi,

I don't use Python on regular basis, so maybe I don't understand something here, but how exactly am I supposed to include your code in my project? Usually I load stuff with PIP, but it seems that you haven't publish PIP package for this repo.

So I tried using git submodule and it seems ok, but I've got a problem with absolute imports - I use Python 3 so statements like import point_grouper as pg won't work unless I include your code in my project root directory - which would be so hacky. ๐Ÿ˜„

I think this could by fixed by replacing import lines with something like from . import point_grouper as pg. What do you think about this?

I feel that PIP package would be more elegant solution.

Redundant index variable

Hi mat, I appreciate your code! However in the following code, when I inspect the variable index, I found that the it is initialized once and then incremented in the loop, however it is never used to assign to anything. And this variable isn't passed to any other function, too. So I wonder is this a redundant variable? If so I think deleting it would make the logic clearer.

def group_points(self, points):
        group_assignment = []
        groups = []
        group_index = 0
        index = 0 # initialization
        for point in points:
            nearest_group_index = self._determine_nearest_group(point, groups)
            if nearest_group_index == None:
                # create new group
                groups.append([point])
                group_assignment.append(group_index)
                group_index += 1
            else:
                group_assignment.append(nearest_group_index)
                groups[nearest_group_index].append(point)
            index += 1 #increment
        return np.array(group_assignment)

Code too slow

I run the code with around 100 *10^3 points but I did not finish after 24 hours. I do not the reason.
Can any one help me to speed up the code with large size data.

Best,

Freezes when using integers

import numpy as np
import mean_shift as ms

mean_shifter = ms.MeanShift()

mean_shifter.cluster(np.array([[1,1], [1,2], [5,5]]), kernel_bandwidth = 2)
# no response, Ctrl + C

mean_shifter.cluster(np.array([[1.0,1.0], [1.0,2.0], [5.0,5.0]]), kernel_bandwidth = 2)
# works

Is it a bug? I would say it should accept integers also.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.