It has been about 4 months since Last Watch AI was first introduced. I received a lot of great feedback from the community and today I am finally releasing a new major version. Full details below.

Last Watch AI - Release 1.1.1

The most difficult part of this project is making it work smoothly on Windows and Linux (still looking for Mac users!). Linux is the preferred environment, but a lot of people out there still prefer Windows. Many IP camera programs like Blue Iris are Windows-only, and most of those users understandably don't want to bother with standing up a separate Linux server. Docker has not been perfect but it is working well enough, so platform independence will continue to be a priority for Last Watch.

Now that I have smoothed out all of the issues with the core functionality, I will be turning my attention to a long list of feature requests and quality-of-life improvements. I am especially interested in improving the setup and upgrade process. Please open a ticket in Github if you have any suggestions – or better yet, open a pull request!

File Watcher and File Storage Improvements

The biggest issues in the previous version of Last Watch have to do with performance while accessing the file system, with many users reporting high CPU usage or high latency when detecting new image files. As it turns out, mounting the watch folder as a volume in docker and hosting the files from the mount was not a great approach.

In v1.1 I have completely re-written the File Watcher so that it moves files out of the watch folder and into the public folder of the web server. This fixes the performance issues by keeping the watch folder virtually empty.

As a result of this change, the web server now stores the images instead of leaving them in the watch folder. This allowed for some other much needed improvements like image compression, preview thumbnails, and automatic deletion.

Detection Event Thumbnails

High Priority Automations

Last Watch handles all of the AI and automation work using queued worker threads. In version 0.x all worker threads had the same priority, meaning the AI detection, webhook calls, and all of the automations were handled on a first-come first-serve basis. This could be a problem if one of your automations needed to be near real-time, such as triggering a video recording. There could be situations where an important automation was blocked for several seconds while waiting for other jobs to finish.

In version 1.1 you can now designate automations to be High Priority when attaching them to a profile.

High Priority Automations

High priority jobs will be processed first. By default, all automations are low priority and the AI job is medium.

Webhook Improvements

The original idea behind the webhook was to expose an API that allowed you to POST image files without having to write images to the watch folder. In version 1.1 the webhook has been rewritten to make this possible. The File Watcher is now just a wrapper around the webhook – you can completely disable the watcher and POST images to the webhook yourself. See the API docs for details.

The downside of this approach is that there is an extra I/O step if you do use the file watcher (the web server has to write the image when it is moved out of the watch folder). I am currently working on a modification to run the AI while the file is in memory, before writing it to disk.

Detection Event UI

The Detection Event page has been cleaned up and improved quite a bit since the first release of Last Watch. The screen now handles large 4k resolution images much better, which pairs nicely with the image compression improvements on the back end. You can also click on the Predictions badge to see all of the predictions from Deepstack, and you filter through each one to see the type of object and the confidence.

Detection Event Predictions

As before, the page shows a list of profiles which were triggered by the event and you can click each profile to highlight the matching predictions. It's also easier to see which objects were masked or filtered by the profile.

Upgrading from Older Versions

If you are upgrading from an older version of Last Watch, there are a few things to be aware of.

Most importantly, the .env file has many new additions. It is recommended that you start over again with one of the example .env files rather than keeping your existing file. Make sure to look over the new file and set your options as desired.

# Back up your old env file
$ cp .env .env.old

# Copy in a new example config and edit it
$ cp configs/.env.linux .env
$ nano .env
Recreating the .env file

Other than the changes to the env file, you can follow the normal upgrade steps.

There is one breaking change to be aware of. Because of the changes to how image files are stored, your old detection events will no longer show their images and will be missing thumbnails.

After upgrading, you should consider deleting everything from your watch folder. Keeping the watch folder clean will prevent the File Watcher from overutilizing CPU. Note that all new images will automatically be purged from the watch folder after they are posted to the application (unless you opt to disable automatic deletion).

Full list of changes

  • Ability to delete automation configurations.
  • Improve detection event UI with better discovery and filtering of predictions for each matched profile and better handling of large images up to 4k resolution.
  • The Watch Folder is no longer mounted in the web application. The web server now manages images files once they are processed into Last Watch.
  • Image files are automatically deleted according to the data retention policy configured in the .env file.
  • File Watcher performance and stability improvements. Added a new config flag to disable automatic deletion of images from the watch folder.
  • Implement worker queue priorities to ensure high priority tasks are run first.
  • Ability to designate automations to be run in high priority mode.
  • Implement Webhook API to POST image files to Last Watch. The Webhook will accept the image and return immediately, handling the AI and automations in background processes.
  • Compress images after the AI processing is finished to reduce file size. Use progressive encoding to help load images faster in web browsers.
  • Add config flag to set image compression quality or to disable compression completely.
  • Show image thumbnails on the detection events list.
  • Create example .env files for windows and linux to separate differences in how each OS should be configured.
  • Add config options to disable optional containers like the File Watcher and Deepstack.
  • Enabled automatic retries for queued jobs. Automations or tasks which fail or time out will be retried up to a maximum of 3 attempts. For example, if Last Watch times out while trying to send an image to telegram, it will try again after 90 seconds. If a job fails 3 times, it will be recorded as an error in the logs.
  • Several fixes for various errors that were logged by automations.