diff --git a/SyncNetInstance.py b/SyncNetInstance.py index 497d44f..e446be0 100644 --- a/SyncNetInstance.py +++ b/SyncNetInstance.py @@ -67,8 +67,15 @@ def evaluate(self, opt, videofile): flist = glob.glob(os.path.join(opt.tmp_dir,opt.reference,'*.jpg')) flist.sort() + _TARGET_SIZE = (224, 224) for fname in flist: - images.append(cv2.imread(fname)) + img = cv2.imread(fname) + h, w = img.shape[:2] + if (w, h) != _TARGET_SIZE: + print("WARNING: Resizing %s from %s to %s" % (fname, (w, h), _TARGET_SIZE)) + interp = cv2.INTER_AREA if (w > _TARGET_SIZE[0] or h > _TARGET_SIZE[1]) else cv2.INTER_LINEAR + img = cv2.resize(img, _TARGET_SIZE, interpolation=interp) + images.append(img) im = numpy.stack(images,axis=3) im = numpy.expand_dims(im,axis=0) diff --git a/detectors/s3fd/box_utils.py b/detectors/s3fd/box_utils.py index 0779bcd..1bf4be2 100644 --- a/detectors/s3fd/box_utils.py +++ b/detectors/s3fd/box_utils.py @@ -35,7 +35,7 @@ def nms_(dets, thresh): inds = np.where(ovr <= thresh)[0] order = order[inds + 1] - return np.array(keep).astype(np.int) + return np.array(keep).astype(int) def decode(loc, priors, variances): diff --git a/requirements.txt b/requirements.txt index 8919740..5614f8f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,6 @@ torch>=1.4.0 torchvision>=0.5.0 numpy>=1.18.1 scipy>=1.2.1 -scenedetect==0.5.1 -opencv-contrib-python +scenedetect +opencv-python python_speech_features diff --git a/run_visualise.py b/run_visualise.py index 85d8925..59d3e0b 100644 --- a/run_visualise.py +++ b/run_visualise.py @@ -69,7 +69,7 @@ for face in faces[fidx]: - clr = max(min(face['conf']*25,255),0) + clr = int(max(min(face['conf']*25,255),0)) cv2.rectangle(image,(int(face['x']-face['s']),int(face['y']-face['s'])),(int(face['x']+face['s']),int(face['y']+face['s'])),(0,clr,255-clr),3) cv2.putText(image,'Track %d, Conf %.3f'%(face['track'],face['conf']), (int(face['x']-face['s']),int(face['y']-face['s'])),cv2.FONT_HERSHEY_SIMPLEX,0.5,(255,255,255),2)