Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

Applying in yolov3 #14

Open
virraaj opened this issue Sep 5, 2019 · 0 comments
Open

Applying in yolov3 #14

virraaj opened this issue Sep 5, 2019 · 0 comments

Comments

@virraaj
Copy link

virraaj commented Sep 5, 2019

Hi, Thank you for your contribution.
I am getting a numpy array of the distances of every pixel in the bounding box. Now I am trying to apply k-means to get the median of distance to the object in my case person. Can you check if my approach is correct?

self.cluster = kmeans.kmeans(np.array(self.kmeans_box_data),2,np.median(self.person_bounding_box))

where self.kmeans_box_data is ((xmax-xmin)/w),(ymax-ymin)/h) 2 is the number of clusters and self.person_bounding_box is the array of distance at every pixel in the bounding box.
I am getting the following exception:

src/kmeans.py", line 11, in iou
    x = np.minimum(clusters[:, 0], box[0])
IndexError: too many indices for array

And when k is greater than 2, I get the following error:

kmeans.py", line 64, in kmeans
    clusters = boxes[np.random.choice(rows, k, replace=False)]
  File "mtrand.pyx", line 1168, in mtrand.RandomState.choice
ValueError: Cannot take a larger sample than population when 'replace=False'

Any suggestions are appreciated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant