How to choose between industry and academia after mediocre past work in both?
You're in the lucky position of having both industry and academic experience. That gives you a much better view of what to do next, and you can use your experience to inform yourself about the better option.

If you go to industry, chances are you'll have a more stable life. You won't have to move as often (possibly never). This could be better not only for you, but also for your child/significant other. You'll be paid more. You'll deal with different kinds of problems. If you're considering this path, I wouldn't worry too much about you being "not good" at machine learning because you've already excelled at your previous role. The odds are also good that you'll have learned something transferable in the course of your PhD.

If you stay in academia, chances are you'll have to move, a lot. Postdocs are transient positions that don't usually last longer than a few years. You'll also usually be paid less - often substantially less - than in industry. On the other hand you'll get to think about blue-skies problems that you might enjoy more, you'll have more flexible hours, and you can often work from home quite easily.

So which option do you want? Only you can make that decision. I'll just suggest one more thing: compare the time you spent in industry (2009-2013) against the time you spent in the PhD (2013-present). If you were stuck in a time loop and had to relive those years again and again, which epoch would you rather relive? I would favour that option.