Closed connormeaton closed 2 years ago
Hmm, nothing immediately jumps out to me. Can you put in a print statement to figure out which image file its failing on? Is there something that makes that image different from the rest? Does the error go away if you remove the file?
Thanks for the quick response. I through in a try/except and print statement to try to figure out what is going on. Here is my code for facer.py
:
# Delaunay triangulation
rect = (0, 0, w, h)
try:
dt = calculateDelaunayTriangles(rect, np.array(pointsAvg))
# Warp input images to average image landmarks
output = np.zeros((h, w, 3), np.float32())
for i in range(0, len(imagesNorm)):
img = np.zeros((h, w, 3), np.float32())
# Transform triangles one by one
for j in range(0, len(dt)):
tin, tout = [], []
for k in range(0, 3):
pIn = pointsNorm[i][dt[j][k]]
pIn = constrainPoint(pIn, w, h)
pOut = pointsAvg[dt[j][k]]
pOut = constrainPoint(pOut, w, h)
tin.append(pIn)
tout.append(pOut)
img = warpTriangle(imagesNorm[i], img, tin, tout)
if return_intermediates:
incremental.append((output + img) / (i + 1))
# Add image intensities for averaging
output = output + img
# Divide by num_images to get average
output = output / num_images
if return_intermediates:
warped.append(img_affine)
except:
print('skipping broken frame...')
pass
incremental = incremental[-num_images:]
print('Done.')
This gave me:
Loading face detector and landmark prediction models...
Done, models loaded.
Found 118 in '../faces'.
(1 / 118): ../faces/ffmpeg_1.jpg
(13 / 118): ../faces/ffmpeg_11.jpg
(25 / 118): ../faces/ffmpeg_13.jpg
(37 / 118): ../faces/ffmpeg_24.jpg
(49 / 118): ../faces/ffmpeg_35.jpg
(61 / 118): ../faces/ffmpeg_46.jpg
(73 / 118): ../faces/ffmpeg_57.jpg
(85 / 118): ../faces/ffmpeg_68.jpg
(97 / 118): ../faces/ffmpeg_8.jpg
(109 / 118): ../faces/ffmpeg_90.jpg
Starting face landmark detection...
Processing 118 images.
(1 / 118): ../faces/ffmpeg_1.jpg
(13 / 118): ../faces/ffmpeg_11.jpg
(25 / 118): ../faces/ffmpeg_13.jpg
(37 / 118): ../faces/ffmpeg_24.jpg
(49 / 118): ../faces/ffmpeg_35.jpg
(61 / 118): ../faces/ffmpeg_46.jpg
(73 / 118): ../faces/ffmpeg_57.jpg
(85 / 118): ../faces/ffmpeg_68.jpg
(97 / 118): ../faces/ffmpeg_8.jpg
(109 / 118): ../faces/ffmpeg_90.jpg
Skipped 1.7% of images.
Starting face averaging for 116 faces.
Image 1 / 116
Image 7 / 116
Image 13 / 116
Image 19 / 116
Image 25 / 116
Image 31 / 116
Image 37 / 116
Image 43 / 116
Image 49 / 116
Image 55 / 116
Image 61 / 116
Image 67 / 116
Image 73 / 116
Image 79 / 116
Image 85 / 116
Image 91 / 116
Image 97 / 116
Image 103 / 116
skipping broken frame...
skipping broken frame...
skipping broken frame...
skipping broken frame...
skipping broken frame...
Image 109 / 116
skipping broken frame...
skipping broken frame...
skipping broken frame...
skipping broken frame...
skipping broken frame...
skipping broken frame...
Image 115 / 116
skipping broken frame...
skipping broken frame...
Done.
Segmentation fault: 11
It seems like there was something fishy with the images (though they looked fine to me and had landmarks predicted).
Unfortunately, python crashes after the Done.
print statement with segmentation fault 11. Have you come across this?
Thanks again!
FYI it worked. Not sure why. Maybe my machine was running too much before and could handle the load. Thanks!
Glad to hear you've got it working. Good luck with your project!
Thanks for this interesting project.
I am running your example on a directory of images. I get this error:
I'm running OpenCV 4.5.3 if thats helpful.
Any ideas? Thank you!