Take all of this with the caveat that I am not a software engineer (though I’ll try to make sure one of ours stops by this post):
I believe in terms of a PURE CellProfiler solution, it would be difficult and annoying to untangle the various packages etc required to make a “lightweight” CellProfiler, though running the full program headless on an embedded system should be possible as a Docker (which is how for example we handle our AWS cloud CellProfiler). It’s very possible that I’m wrong though, and that you could bypass some of the requirements by calling CellProfiler modules individually in a python script; I’m simply not sure.
You could absolutely just look at the underlying algorithms; most of CellProfiler’s complexity comes from the GUI, so a bespoke script doing just exactly the things you care about could certainly ditch many of the required packages and would be computationally much less costly (though of course at the cost of flexibility).
Our team is also working on more lightweight solutions, though my understanding is that for right now they primarily deal with measurement as opposed to segmentation. They’re significantly faster than CP though!
I hope that’s enough to begin answering your question; please let me know if I can clarify anything here!