VorlonCD / bi-aidetection

Alarm system for Blue Iris based on Artificial Intelligence.
https://ipcamtalk.com/threads/tool-tutorial-free-ai-person-detection-for-blue-iris.37330/
GNU General Public License v2.0
205 stars 45 forks source link

Allow input files without dot #97

Closed MFornander closed 3 years ago

MFornander commented 3 years ago

I'd like to use the IPCam's motion detection instead of BI. The Amcrest cameras do not allow for changing the filename and there is no dot in the fixed default path/name.

Leaving the AI Tool "Input file begins with" field blank, still results in a filename match of .xxxxx.jpg which will not match a file such as "image.jpg"

Request: Please remove the added dot when matching so leaving blank will find any images. I will use path to differentiate between cameras.

VorlonCD commented 3 years ago

You can already use a wildcard for prefix matching. Just by putting a in "Input file begins with" will trigger wildcard matching rather than using the prefix.resetoffile.jpg. So use CAMERANAME for example.

Also, when NOT using a wildcard, and no "dot" prefix is found in the filename, it will fall back to matching the camera up with each cameras INPUT PATH. That only works if your input path is different per camera.

MFornander commented 3 years ago

Thanks for the quick reply and awesome work. I tried the * wildcard and I'm getting this error: Cannot match 'Z:\b-trash\2020-12-02\001\jpg\18\24\26[M][0@0][0].jpg' to an existing camera.

Z:\b-trash\ is the root where the ipcam is putting its images and the path is based on time. I have no control over this, just the root. So AI-Tool is still looking for b-trash to match to a camera an fails. Any way to just process all the images under the root as specified in UI?

MFornander commented 3 years ago

image

MFornander commented 3 years ago

BTW the reason I'm doing this is to allow BI to not decode any frames and simply save the h265 stream directly to HD. I'l, then ask the cameras to use their motion detection and save images every 1s to an NFS mount and have AI-Tool look at them and flag the BI stream with an external trigger.

This way there is a little bit of noise since the IPCam motion detection is not that good (lots of false positives) but with AI-Tool running on a separate box/image I can have a separate machine validating the high-res snapshots and tag the BI machine.

Two separate systems with BI being more of a continuous recorder and the AI-Tool with IPCam snapshots being a separate flagger. THis can be a nice GPU accelerated machine if need be but the main point is that it's a separate unit taht doesn't interfere with BI.

VorlonCD commented 3 years ago

take out everything from input file begins with, or replace it with any word even if it doesnt match.

That way it should force the camera to be matched based on the INPUT FOLDER path alone.

MFornander commented 3 years ago

Empty: No enabled camera with the same filename, cameraname, or prefix found for 'Z:\b-trash\2020-12-02\001\jpg\18\38\07[M][0@0][0].jpg

"BLAH": Cannot match 'Z:\b-trash\2020-12-02\001\jpg\18\42\24[M][0@0][0].jpg' to an existing camera. Object reference not set to an instance of an object. [NullReferenceException] Mod: OnCreated(Object source, FileSystemEventArgs e) Line:607:29 No enabled camera with the same filename, cameraname, or prefix found for 'Z:\b-trash\2020-12-02\001\jpg\18\42\44[M][0@0] No default camera found. Aborting.

MFornander commented 3 years ago

Restarted AI-Tool and tried empty and "any word":

Empty: image

"BLAH": image

MFornander commented 3 years ago

That way it should force the camera to be matched based on the INPUT FOLDER path alone.

This exactly what I want thanks.

MFornander commented 3 years ago

Running 2.0.37.7608 built on 10/30/2020 8:48:57 AM BTW

MFornander commented 3 years ago

This shows the best promise after a full restart. The input field is empty and I get:

image

MFornander commented 3 years ago

Also tried to restart everything (cam, fileserver, ai-tool) but I'm getting these in the log even though the filenames are different. The ImgQueued keeps rising even though it's "skipping" and finally hits 100 and gives up.

image

MFornander commented 3 years ago

Ok giving up for a while. Where is the relevant code? I'm a software engineer with 30+ years of C/C++/C# experiance so maybe I can fix this and submit a MR?

MFornander commented 3 years ago

Sorry about this spam first of all.

Digging into your C# code and the detection_dictionary, I realized that the camera was saving multiple images per second so ignore the "Skipping image..." messages since they are indeed correct! :smile:

Still, I can't see a way to get around the "No enabled camera..." error, even with your tips of leaving the field blank or using *. Could you try to save an image manually at a path mimicking my path to see if it's my setup or the code?

MFornander commented 3 years ago

Figured out that this is a subfolder scanning problem not a naming problem. Closing this issue since your solution works without subfolders and opening another.

VorlonCD commented 3 years ago

Great. I think I should remove that GetCamera error when it actually finds the camera based on the camera path.