CodeProject.AI Version 2.5

tigerwillow1

Known around here
Joined
Jul 18, 2016
Messages
3,860
Reaction score
8,547
Location
USA, Oregon
I didn't do a formal 2x2 or 3x3 segmentation, but tried some crops of undetected animals. It helped a little bit. Not even close to a solution. I'm posting some examples run through ipcam-general, ipcam-animal, ipcam-combined, and ipcam-dark.. The full-frame pictures are thumbnails. This is post 1 of 2.

1. The distant cat at night:
Original full frame: no hits.
Original full frame with increased contrast, no hits.
Original frame cropped: no hits.
Cropped image with increased contrast: ipcam-dark dog 87%.

cat.jpg cat-lightened.jpg crop-cat.jpg crop+contrast-cat.jpg


Coyote #1 at night:
Original full frame: no hits.
Cropped image: ipcam-combined person 51%.

coyote1-night.jpg crop-coyote1-night.jpg


Coyote #2 at night:
Original full frame: no hits.
Cropped image: no hits.

coyote2-night.jpg crop-coyote2-night.jpg


Coyote in daylight. A winner with the cropped image.
Original full frame: no hits.
Cropped image: ipcam-animal cat 46%, ipcam-combined dog 73%, ipcam-dark dog 90%.

coyote-day.jpg crop-coyote-day.jpg
 

mailseth

Getting the hang of it
Joined
Dec 22, 2023
Messages
126
Reaction score
88
Location
California
Sounds like progress? From what I'm seeing, the cropped/zoomed images are pretty blurry due to motion. Perhaps you could reduce your shutter speed? What is it currently set at?
 

mailseth

Getting the hang of it
Joined
Dec 22, 2023
Messages
126
Reaction score
88
Location
California
I did a quick search for 'small object detection' and came up with these articles:

How large are the ipcam models? Perhaps you can export a custom YOLOv8 model with a 1280x1280 input resolution? The other solution (SAHI) is what we've mentioned with slicing the image into smaller images and combining those results:
SAHI is a technique for running inference on a computer vision model which aids in detecting smaller objects in an image. SAHI involves running inference on smaller segments of an image, then patching together the results to show all of the detections in an image.
 

tigerwillow1

Known around here
Joined
Jul 18, 2016
Messages
3,860
Reaction score
8,547
Location
USA, Oregon
Three more cropped images run through CPAI.

Squirrel #1 (on top fence rail):
Original full frame: no hits (except rock identified as a horse).
Cropped image: no hits.
Cropped image with increased contrast: no hits.

squirrel1.jpg crop-squirrel1.jpg crop+lighten-squirrel1.jpg


Squirrel #2 (still on top rail).

Original full frame: no hits.
Cropped image: ipcam-animal bird 77%.
Cropped image with increased contrast: ipcam-animal bird 87%, ipcam-combined bird 62%.

squirrel2.jpg crop-squirrel2..jpg crop+lighten-squirrel2..jpg



Rabbit at night. There's really a rabbit as part of the overexposed mess. It can't be found in the still picture. IVS found it, and it can be spotted and identified
watching the video. CPAI is helpless with this one, but it did label a brick on the ground as a vehicle.

rabbit.jpg .crop-rabbit.jpg
 

mailseth

Getting the hang of it
Joined
Dec 22, 2023
Messages
126
Reaction score
88
Location
California
Part of the problem here is that all of these animals have spent quite a long time working on How Not To Be Seen, and they're good at it. (It's what keeps them alive, after all.) I can't find the rabbit in your last one and your squirrel is a bit of a mess with the compression artifacts. Are you able to increase your video quality to a higher bitrate? Are you using Wide Dynamic Range? (It tends to reduce contrast.)
 

tigerwillow1

Known around here
Joined
Jul 18, 2016
Messages
3,860
Reaction score
8,547
Location
USA, Oregon
Are you able to increase your video quality to a higher bitrate? Are you using Wide Dynamic Range? (It tends to reduce contrast.)
The camera is a 5442, bitrate is 6144 Kb/s, the highest it can be set to with h.265. WDR is off. Could h.264 work better with CPAI? Visually the image is more detailed using h.265. I'm running auto mode at night. I can try shutter priority tonight.
 

mailseth

Getting the hang of it
Joined
Dec 22, 2023
Messages
126
Reaction score
88
Location
California
Yeah, auto mode at night might be the problem. I'd start with these posts:
 

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,192
Reaction score
49,093
Location
USA
The camera is a 5442, bitrate is 6144 Kb/s, the highest it can be set to with h.265. WDR is off. Could h.264 work better with CPAI? Visually the image is more detailed using h.265. I'm running auto mode at night. I can try shutter priority tonight.
I would try H264H at higher bitrate and avoid the macroblocking that happens with H265 that may be just enough to cause some issues?
 

Vettester

Getting comfortable
Joined
Feb 5, 2017
Messages
749
Reaction score
705
Squirrel #1 (on top fence rail):
Original full frame: no hits (except rock identified as a horse).
Cropped image: no hits.
Cropped image with increased contrast: no hits.
Using YOLOv5Net and the ipcam-dark model your squirrel #1 cropped image is identified as a cat.

Screen Shot 2024-02-02 at 9.12.52 PM.png
 

tigerwillow1

Known around here
Joined
Jul 18, 2016
Messages
3,860
Reaction score
8,547
Location
USA, Oregon
I set 2 of the 5442s to h264@8192, shutter on one to 1/100 and the other to 1/500. Before I did this a bobcat walked past one of them, identified as as 77% fox and 84% dog. A piece of downed tree limb in the same picture came out as 54% person.
 

tigerwillow1

Known around here
Joined
Jul 18, 2016
Messages
3,860
Reaction score
8,547
Location
USA, Oregon
Using YOLOv5Net and the ipcam-dark model your squirrel #1 cropped image is identified as a cat.
When the custom models are there does a capture also get run through YOLOv5. I don't think mine is doing this. Is it anything I can control with a setting?
 

CCTVCam

Known around here
Joined
Sep 25, 2017
Messages
2,676
Reaction score
3,508
I'm seeing 2 obvious issues here:

1. It's struggling with the size of the animal and it being too far away. If you're already on small object, maybe it's just pushing the AI too far for that distance. Isn't the object size defined in CPAI by the resolution of the object in pixels square? I use medium because I have no interest in recording wildlfie but I'm pretty sure when choosing the size model it told me the object size for medium as x pixels by y pixels. It could be the object is below the trigger pixel threshold at the distance.

The long distance might also be causing a background separation issue which is my 2nd issue

2. The squirrel on the fence issues doesn't surprise me as the background is very similar to that of the squirrel so from an AI perspective, if it looks at shape, it's probably having difficulty picking out the squirrel from the fence and trees which may look to the AI as one. The trees are nearly identical in shade, the background ins't far off, and the fence potentially in the AI's eyes either adds to the shape of the squirrel reducing the probability or connects the trees and squirrel into 1 object. You could try reducing the probability at the risk of more false positives. I only run 50% on mine and have almost zero false positives but hen again mines only looking for cars, people and bikes and I have a pretty static urban environment nearest the cameras. So I maybe able to get away with a lower probability than most.
 

Vettester

Getting comfortable
Joined
Feb 5, 2017
Messages
749
Reaction score
705
I need to be more specific: Is there a way to run trigger pictures through YOLO and the custom models?
You can take a screenshot of the trigger image and use that in CPAI Explorer or setup BI to capture the trigger image to a specific directory.
 
Last edited:

mailseth

Getting the hang of it
Joined
Dec 22, 2023
Messages
126
Reaction score
88
Location
California
Another idea: an IR flood light to help those night pictures.

Really depends on how much experimentation you want to do.
 
As an Amazon Associate IPCamTalk earns from qualifying purchases.

David L

IPCT Contributor
Joined
Aug 2, 2019
Messages
8,106
Reaction score
21,218
Location
USA
@tigerwillow1
You need to train your critters to be more photogenic ;)

I had a cantilever umbrella with a tan cover (looked like a trench coat), that when the wind blew it, AI would identify it as a person. My fix was to block out that area. I know I will be dealing with the same as you when I set my cams back up. With all our trees/branches/leaves blowing around I am sure I will have fun...which reminds me, one early morning I was leaving and noticed on our drive what looked like a rabbit, found out later coming back home it was only a clump of leaves...lol.

Found my post of the rabbit, lol

 

Vettester

Getting comfortable
Joined
Feb 5, 2017
Messages
749
Reaction score
705
@MikeLud1, I'm seeing a lot of these timeout error messages in the log files of the latest version of CPAI (2.5.1). They appear to be tied to the ALPR module (2.9.0), but don't seem to be causing any issues. Can I just ignore them or is this something that needs to be addressed?

18:14:30:License Plate Reader: [TimeoutError] : Traceback (most recent call last):
File "C:\Program Files\CodeProject\AI\modules\ALPR\ALPR.py", line 83, in detect_platenumber
data={"min_confidence": opts.plate_confidence})
File "../../SDK/Python\module_runner.py", line 873, in call_api
timeout = self._response_timeout_secs
File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python37\venv\lib\site-packages\aiohttp\client.py", line 1167, in aenter
self._resp = await self._coro
File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python37\venv\lib\site-packages\aiohttp\client.py", line 586, in _request
await resp.start(conn)
File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python37\venv\lib\site-packages\aiohttp\client_reqrep.py", line 920, in start
self._continue = None
File "C:\Program Files\CodeProject\AI\modules\ALPR\bin\windows\python37\venv\lib\site-packages\aiohttp\helpers.py", line 725, in exit
raise asyncio.TimeoutError from None
Bump, I now know that this not an isolated issue on my system. Any ideas on how to resolve this @MikeLud1 ?
 

VideoDad

Pulling my weight
Joined
Apr 13, 2022
Messages
163
Reaction score
219
Location
USA
Which Object Detection module are you using? The timeout might be when the ALPR module uses the Object Detection module to detect the plate in the image.
If it helps provide another data point, I'm not using the ALPR module and I'm using CPU only and I'm seeing the AI timeout 500 message in my logs too (on 2.51).

Anything I can do to help narrow down the cause?
 
Top