GithubHelp home page GithubHelp logo

Error running code about facer HOT 4 CLOSED

johnwmillr avatar johnwmillr commented on June 25, 2024
Error running code

from facer.

Comments (4)

johnwmillr avatar johnwmillr commented on June 25, 2024

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?

from facer.

connormeaton avatar connormeaton commented on June 25, 2024

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!

from facer.

connormeaton avatar connormeaton commented on June 25, 2024

FYI it worked. Not sure why. Maybe my machine was running too much before and could handle the load. Thanks!

from facer.

johnwmillr avatar johnwmillr commented on June 25, 2024

Glad to hear you've got it working. Good luck with your project!

from facer.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.