pyannote / pyannote-video

Face detection, tracking and clustering in videos
http://pyannote.github.io
MIT License
440 stars 129 forks source link

Run pyannote-structure.py get IndexError #17

Closed fupeng closed 7 years ago

fupeng commented 7 years ago

Run in docker with 'pyannote/video:latest' and get output:

root@1477f7c02867:/scripts# pyannote-structure.py --version pyannote-structure 1.3.14 root@1477f7c02867:/scripts# pyannote-structure.py shot --verbose /data/TheBigBangTheory.mkv /data/TheBigBangTheory.shots.json 0%| | 0.00/752 [00:00<?, ?frames/s] Traceback (most recent call last): File "/usr/local/bin/pyannote-structure.py", line 112, in height=height, window=window, threshold=threshold) File "/usr/local/bin/pyannote-structure.py", line 67, in do_shot shots = Timeline(shots) File "/usr/local/lib/python2.7/dist-packages/pyannote/core/timeline.py", line 162, in init segments = [s for s in segments if s] if segments else [] File "/usr/local/lib/python2.7/dist-packages/pyannote/video/structure/shot.py", line 120, in iter t, y = zip(*self.iter_dfd()) File "/usr/local/lib/python2.7/dist-packages/pyannote/video/structure/shot.py", line 113, in iter_dfd yield t, self.dfd(previous, current, flow=None) File "/usr/local/lib/python2.7/dist-packages/pyannote/video/structure/shot.py", line 95, in dfd self._reconstruct[y, x] = current[ry, rx] IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

Also get the same error from jupyter notebook.

fupeng commented 7 years ago

After change to another docker image(askaditya619/pyannote), everything works fine.

hbredin commented 7 years ago

Thanks for reporting this issue. I just reopened it because the solution you used does not actually solve the issue .

Where does this askaditya619/pyannote docker image come from? Do you have any idea how it solves the problem?

I'd be happy to integrate any fixing changes to pyannote/video Docker image, but before that, we need access to askaditya619/pyannote Dockerfile.

fupeng commented 7 years ago

The image is from https://hub.docker.com/r/askaditya619/pyannote, but no dockerfile is provided.

The docker history for this image is attached and hope it is useful.

docker history.txt

sachin-jamdade commented 7 years ago

i am also getting same error no success yet.

hbredin commented 7 years ago

I cannot deal with this issue right now but I believe it comes from the latest numpy release: https://docs.scipy.org/doc/numpy/release.html#deprecationwarning-to-error

I think solving this issue is just a matter of replacing

rx = max(0, min(x + dx, width - 1))
ry = max(0, min(y + dy, height - 1))

with

rx = int(max(0, min(x + dx, width - 1)))
ry = int(max(0, min(y + dy, height - 1)))

at line https://github.com/pyannote/pyannote-video/blob/master/pyannote/video/structure/shot.py#L93-L94

Can someone let me know if that solves the issue and I'll release a new version next week.

sachin-jamdade commented 7 years ago

Yes @hbredin solution is working. I am new to python and trying to follow "Getting started" tutorial when i execute following code

result = clustering(face_tracks, features=openface).anonymize_labels() result

I Get the Following error. The full trace is as below

AttributeErrorTraceback (most recent call last)

in () ----> 1 result = clustering(face_tracks, features=openface).anonymize_labels() 2 result /usr/local/lib/python2.7/dist-packages/pyannote/algorithms/clustering/hac/hac.pyc in __call__(self, starting_point, features, callback) 202 self._initialize(starting_point, features=features) 203 --> 204 for i, current_state in enumerate(self._iterate()): 205 if callback is None: 206 continue /usr/local/lib/python2.7/dist-packages/pyannote/algorithms/clustering/hac/hac.pyc in _iterate(self) 130 while True: 131 --> 132 clusters, similarity = self.model.get_candidates(parent=self) 133 msg = ( 134 "Next merging candidates are " /usr/local/lib/python2.7/dist-packages/pyannote/algorithms/clustering/hac/model.pyc in get_candidates(self, parent) 156 157 """ --> 158 return self._similarity.peekitem(index=-1) 159 160 def block(self, clusters, parent=None): /usr/local/lib/python2.7/dist-packages/xarray/core/common.pyc in __getattr__(self, name) 223 return source[name] 224 raise AttributeError("%r object has no attribute %r" % --> 225 (type(self).__name__, name)) 226 227 def __setattr__(self, name, value): AttributeError: 'DataArray' object has no attribute 'peekitem' Please see.
hbredin commented 7 years ago

I just released a new version that should fix this.