Author Topic: Snake detection AI  (Read 823 times)

0 Members and 1 Guest are viewing this topic.

Offline NiHaoMikeTopic starter

  • Super Contributor
  • ***
  • Posts: 9015
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Snake detection AI
« on: October 02, 2022, 10:29:16 pm »
Is there a good existing project for detecting snakes in videos? It doesn't have to identify the kind of snake, just whether or not there's a snake in the frame.

The problem I'm trying to solve is that a good friend of mine is absolutely terrified of snakes even in videos, I want to screen videos so I can watch them with her without her freaking out and completely spoiling the experience. (It could be a completely harmless snake in a situation where it can't get near her and she'll still freak out, that's what makes it so problematic.)
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6255
  • Country: fi
    • My home page and email address
Re: Snake detection AI
« Reply #1 on: October 04, 2022, 12:51:06 pm »
This is not the answer you are looking for, but... ophidiophobia is quite treatable with exposure therapy and cognitive behavioural therapy.  Even though it is natural (like arachnophobia; that is, these phobia may be naturally evolved in us humans), there is absolutely no reason to suffer from it.

I have slight arachnophobia myself –– that is, I still jump a bit initially at seeing one –– but it is no longer an issue: I can even let an arachnid walk on me.  In my case, it happened naturally, because where I grew up, they were very efficient in nabbing mosquitoes, gnats, and no-see-ums ("hyttynen", "mäkäräinen", "polttiainen"), especially indoors.  Basically, they were preying on pests that really bothered me.  I just couldn't perceive something doing such a favour for me as any kind of a danger, especially because there are zero arachnid species dangerous to humans in Finland (and only a single venomous ophid species, vipera berus, with venom not much worse than a bee sting).  The change didn't happen before I was an adult, though.

I do like ophids (and mustelids and foxes) a lot, specifically because they prey on bank voles, which can carry the Puumala orthohantavirus.  Native Finns seem to have a natural, inherited1 protection against it, so much so that children usually show no symptoms or mild cold like symptoms at most, but it is dangerous to anyone without genetic roots in Northern Europe.
Again, when something or someone does me so big a favour and expecting nothing in return, and are physically no danger to myself at all, I just cannot help but feel they're a positive thing in my life.  I still jump a bit, but that's all.

Perhaps your friend could find something similar?  As someone who has had issues with panic attacks –– the first one when I was thirty years old or so! –– and dealt with them in a similar manner, I can attest that dealing with this kind of thing is much better, and much less work, than just trying to avoid it.

1 Analysis of 5000-year-old DNA taken from remains found in Sweden most closely matched modern-day Finnish individuals, which indicates that the majority of modern Finnish population has resided in the Fennoscandic area for at least 5000 years; even though this is an unacceptable concept to modern Finns and most Swedes, who insist Finns are a recent arrival, a Turanic people originating from a bend in the river Volga in current Russia about a thousand years ago, with the Sámi having been pushed North due to the invading Finns.  Because archaeological record matches the bog body DNA samples, Finland has stopped supporting any research into this, to retain the political and ideological status quo, and stop facts from muddying an 'useful' political narrative.
« Last Edit: October 04, 2022, 12:52:53 pm by Nominal Animal »
 
The following users thanked this post: MK14, Deku Tree

Offline NiHaoMikeTopic starter

  • Super Contributor
  • ***
  • Posts: 9015
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Snake detection AI
« Reply #2 on: October 04, 2022, 11:46:40 pm »
She's really afraid, I don't think it would be an easy fix. Actual message from her:
Quote
You couldn’t imagine how much I fear snakes. When I graduated from high school, i visited a zoo with my families, I was atremble and teary when we were in the [snake’s] area even thought I just seen the pics in the windows not the real ones. Even I  couldn’t stand up at that time, my family carried me out.
Although in the long term fixing the problem would be better, in the near term I think an AI would be a good workaround.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6255
  • Country: fi
    • My home page and email address
Re: Snake detection AI
« Reply #3 on: October 05, 2022, 12:43:58 am »
She's really afraid, I don't think it would be an easy fix.
It is not as easy as shown in some TV shows, but with a therapist specializing in this (via cognitive behavioural therapy and exposure therapy), it is quite straightforward and effective.  The fear itself does not "go away", the end result is more that you do not get a panic attack or lose control of your body or want to run away: you stay fully functional and aware that there is no danger.  Essentially, you just overcome the fear.  (Well, many do lose the fear too, in time, via repeated exposure, but that can take years.)

As to the image detection, I don't think such a project would be particularly successful, because many pets mistake ropes and cucumbers with snakes.  Expecting "an AI" to do better is not very realistic, I think.
 
The following users thanked this post: SiliconWizard

Offline NiHaoMikeTopic starter

  • Super Contributor
  • ***
  • Posts: 9015
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Snake detection AI
« Reply #4 on: October 05, 2022, 12:55:18 am »
As to the image detection, I don't think such a project would be particularly successful, because many pets mistake ropes and cucumbers with snakes.  Expecting "an AI" to do better is not very realistic, I think.
I'm thinking of a script I can run that would flag times where there may be a snake, then I can review to confirm. False positives are OK as long as they don't happen so often that the script becomes useless.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Snake detection AI
« Reply #5 on: October 06, 2022, 03:30:08 pm »
Good luck finding a pretrained model.  If it exists, it will be buried in academia.

In any event, the project goes toward Computer Vision and Object Detection:

https://towardsdatascience.com/object-detection-using-google-ai-open-images-541ea601cfa5

It's a fairly well understood process but it takes a LOT of images.  Probably on the order of 10,000 images with snakes (there are lots of kinds of snakes and many poses) and 10,000 images of similar backgrounds without snakes.  Getting the images is the real problem.  Maybe Google has some, probably not.

A little study in Convolutional Neural Networks will help because one thing is certain, you need to reduce the dimensionality of a million+ pixel image.  Starting with Tensorflow and Keras is probably good although there are several alternatives.  MATLAB has a very easy CNN approach.  It takes about 50 lines of code to recognize hand written digits.

https://youtu.be/py5byOOHZM8
https://towardsdatascience.com/mnist-handwritten-digits-classification-using-a-convolutional-neural-network-cnn-af5fafbc35e9
https://www.mathworks.com/help/deeplearning/ug/data-sets-for-deep-learning.html

Considering the size of the problem, I have no idea how much compute time it will take to train the snake model but I'll bet it is months on a CPU and weeks on a GPU.  Google, among others, sells time on their massively parallel GPUs and parallelism is important when you are multiplying million element tensors.

Good luck!  I'm one of those with an unhealthy fear of snakes.  Probably a result of nearly being eaten in a couple of rattlesnake encounters.  And, yes, southern fried rattlesnake does taste like chicken.

ETA:  I ran across this but haven't pursued it:
https://deeplearning.cms.waikato.ac.nz/user-guide/class-maps/IMAGENET/

« Last Edit: October 06, 2022, 03:48:23 pm by rstofer »
 
The following users thanked this post: Someone, MK14, Nominal Animal


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf