ValueError: empty range for randrange() (0,0, 0)
Opened this issue · 1 comments
python grabcut.py images/img4.jpg
Run the above command and press N to report an error!!!
Traceback (most recent call last):
File "grabcut.py", line 72, in
GC.run()
File "/home/cym/PycharmProjects/GrabCutOrcuslc/main.py", line 444, in run
self.init_with_kmeans()
File "/home/cym/PycharmProjects/GrabCutOrcuslc/main.py", line 312, in init_with_kmeans
KMF = kmeans(self._FGDpixels, dim = 3, n = self.k, max_iter = max_iter) # The Foreground Model by kmeans
File "/home/cym/PycharmProjects/GrabCutOrcuslc/k_means.py", line 19, in init
self._init_centers()
File "/home/cym/PycharmProjects/GrabCutOrcuslc/k_means.py", line 26, in _init_centers
rindex = random.randint(0, self.rows-1)
File "/home/cym/programfiles/anaconda3/envs/py36pt15/lib/python3.6/random.py", line 221, in randint
return self.randrange(a, b+1)
File "/home/cym/programfiles/anaconda3/envs/py36pt15/lib/python3.6/random.py", line 199, in randrange
raise ValueError("empty range for randrange() (%d,%d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (0,0, 0)
I also have the same issue. @yumingchen , did you discover the solution for this?