I'd settle for a simple camera attached to the fridge and another in the pantry. Place it on a linear slider and give it control over the lighting. Then an open source APK and Rπ server with easy encryption keys allows me to peek in the fridge or pantry to see if something is present or not. It doesn't have to be perfect. Just a fifty fifty chance or better that checking the camera might show what I have or not.
Impossible fantasy because criminal stalkerware data miners would teabag the hell out of such an idea.