Octolapse with Motion Detection software to detect failed prints

Had an idea for new feature. Motion Detection software can detect large changes from one image to the next. OctoLapse can create images with minimal changes between images during a normal print (after the first few layers are printed). But during a failed print, it would change pretty significantly. Enough that motion detection software could pick it up. This could be used to send a message (email, text, etc) to check out the Print and stop it if needed before wasting a ton of filament and time.
https://www.raspberrypi.org/forums/viewtopic.php?t=86732
https://www.raspberrypi.org/forums/viewtopic.php?t=209236

Would need a way to use the software to compare a new image to the previous image(s) when a new image is saved instead of using a live video stream.

Here are some examples that would definitely send an alert on a print fail. Huge difference in the image when the print fails.

You mean do the calculation on the Pi rather than in the cloud like spaghetti detective?

Would probably need a Pi4, a lot of people report performance issues with webstream and pi3+ with octoprint, so that would probably just kill it.

Exactly. Use motion detection software directly on Pi 3+ (see links above for examples of motion detection software for Pi3). I would assume comparing 2 still images every couple of seconds would be significantly less resource intensive than analyzing a live video stream or even serving up a live video stream.
https://motion-project.github.io/

Would be easier if printer was a delta with a static bed or you were using Octolapse and therefore had a static model to work with. You are going to need to take into account where the model is, otherwise a lot of false positives.

So spaghetti detective does exactly what you're saying, it uses snapshots and send to its AI/Machine Learning algorithm. You don't have to use their cloud service and can actually run your own server in-house local to the network. Running it directly on the Pi on the other hand is not recommended based on some discussions with one of the developers in the OctoPrint discord.

The intent would be to use OctoLapse to take the pictures so that delta between the pics was minimal (see videos I attached above) and therefore would not trigger false positives. Any false positives should be able to be mitigated in the software settings of the motion detection software. Video Motion Detection software does exist for the Pi3+. I linked to a popular one above (called Motion). I believe it is open source. It could be modified to look for .jpg files in specific directory and perform the comparison of the 2 latest images anytime a new file is added to the directory. This would be instead of looking at live video from a URL. Unfortunately this is beyond my skillset, but was hoping that the people who created OctaLapse or TSD (or anyone else) might be able to take a look at the existing Pi Motion Detection (ie https://motion-project.github.io/) software and modify it.

The idea is to have it run on the same Pi3+ that is running OctaPrint so that it is an all in one solution, not requiring an extra server to be up 24/7 or to have to pay for a service. Also sending images to another source seems less than ideal when an all in one solution is possible.

Yeah, I've been using motion for years for streaming from a pi zero w to octoprint for multiple camera views. I don't use the motion part of it of course, just the mjpeg streaming capabilities and ability to hook into ip cameras. The idea is solid, but even with the 8GB pi I would be concerned with running it on the same machine and getting bad print quality. Open CV would be the first place I would start looking, and I believe I've seen other posts here in the forum, possibly on github discussing the same thing.

I should think a pi4 with 8 GB would be okay. I run a Plex media server from a Pi4, 4GB and it does on the fly transcoding and feeds multiple TVs/devices at the same time (and it replaced a 4GB mac mini with SSD). Although using the same Pi for Octoprint and the cameras as well as handling the picture comparison I wonder if CPU might start to be a factor. Certainly the reviews I have seen of the Pi4 8GB have show that it usually runs out of CPU before memory (although those reviews are usually as a desktop replacement).

Why Pi 8GB? The only additional resources to what most people are using OctoPrint and OctoLapse for would be taking 2 images and comparing them every couple of seconds. It would not be doing analysis of live streaming video (ie analyzing 15 frames a second every second). Also I'm not sure the Pi4 8GB is supported. Says Pi4 8GB isn't supported when you download the latest release but don't know if that is still accurate.

I'm not sure 8GB of memory is needed either but I would purchase a RPi 4 4GB model.

It won't be that long before the 8GB model is supported by OctoPi / OctoPrint. The 8GB model has some changed/additional hardware that needs to be initialized, and the current "Buster" release doesn't do that. The 64-bit OS needed to fully utilize the 8GB of memory is a "beta" version but it is currently the only image capable of initializing the hardware.

Even pi zero could do it. The proposed algo is simple.

i just setup a octopi today because i though this was already a feature.
any news on this?

the spaghetti detective and print nanny or the only two plugins I know of that will detect failed prints.