element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Save The Bees Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Save The Bees Design Challenge
  • More
  • Cancel
Save The Bees Design Challenge
Blog Honey Bee Safe: Bees, Hornets, and Blooms: rebuilding the model with bees and hornets
  • Blog
  • Forum
  • Documents
  • Leaderboard
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Save The Bees Design Challenge to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ntewinkel
  • Date Created: 25 Apr 2023 9:50 PM Date Created
  • Views 395 views
  • Likes 6 likes
  • Comments 0 comments
  • save the bees
  • savethebeesch
  • Honey Bee Safe
  • nicla vision
  • openmv
  • edge impulse
  • arduino
Related
Recommended

Honey Bee Safe: Bees, Hornets, and Blooms: rebuilding the model with bees and hornets

ntewinkel
ntewinkel
25 Apr 2023
Honey Bee Safe: Bees, Hornets, and Blooms: rebuilding the model with bees and hornets

Now that we have our "real" bee and hornet ready for showtime, I had to rebuild the Edge Impulse model from scratch using pictures of the new characters.

The cast is ready for action!
The cast

Behind the scenes on the set:
Honey Bee Safe - behind the scenesHoney Bee Safe - behind the scenes 2Honey Bee Safe - behind the scenes 3

I took about 50 images each of the bee and hornet in various positions on our tree of blossoms. I also took about 20 pictures of just the blossomy tree to use as background.
so many images

I just read that the recommendation is to have at least 1500 images with at least 10,000 labelled objects! Yikes! I'll be here all year! I'll be here all year anyway, but I'll be doing more fun stuff than labelling bees and hornets Smile

While creating the model in Edge Impulse though, it does mention that the chosen base model is quite good with small datasets, so that gives me hope.

Then I had to go through and draw little boxes around every bee and every hornet in all the pictures. Thankfully Edge Impulse seems to have added a feature that helps detect the same object in the next picture as you go through, so it was mostly a process of tweaking the boundaries.
bee in a boxtraining the model

After all of that I ran the training, and the results were a little disappointing - it was ok for the murder hornet detection, but nearly 3/4 of the bee pictures in the test set were classified as background.
training results round 1

This made me wonder if, while drawing the bounding boxes, it's best to focus on the main features of the bee and hornet, rather than the whole thing - ie, the antenna and wings might not be unique enough, and the big stripey body and the face details might be all that is needed to get a good result.

So I tried again - adjusting most of the bounding boxes on the bee images to reduce the amount of background blossomy bits and focus just on the main features. It's a bit more tedious, as I couldn't find a way to return all the images back to the queue, and had to go one by one.

edit bounding box labels

updating bee box label - beforeupdating bee box label - before
Updating bounding boxes


That helped a lot for the bees, but now the hornets were not identified as successfully.
training results round 2

Adjusting the hornet picture bounding boxes and re-training the model gave a more balanced result. Less accurate for bees, but more accurate for the hornets. I guess the hornet detection part is the most important bit, so we'll leave it like this.
training results round 3

At this point I also realized I didn't take any pictures of just the bee and just the hornet, without the blossomy tree, for the training data set. That might help increase accuracy. It's also possible that the 10% of pictures used for testing are not that representative of what the bee and the hornet really look like. It's only 5 testing pictures each, afterall.

So I built the firmware and uploaded it to the Nicla Vision, and tested it out.

Pointing it just at the bee and then at the hornet gave good results.

debug info detecting bees

It also saved the image of the hornet on the Nicla Vision drive! I had forgotten about this feature until I opened up the drive to update the script.
It shows a small issue - the murder hornet is being identified as both a hornet in one place and a bee in another place. But the main purpose is being served - we've identified a murder hornet in the area that poses a danger. Yay!
It's possible that the faces of the stunt bee and hornet are too similar to differentiate them fully. This is where having 10,000 objects might make it more accurate! Sweat smile
hornet picture saved on Nicla Vision drive

I think this means we are ready to do a "field test". I copied my own script to the Nicla Vision drive, and renamed it to be "main.py", so that it will be the script that runs when the board starts up.

setting a custom main script

Now we just need to plug in the board anywhere, without needing a connection to my computer and OpenMV, and it should run independently to detect our stunt bee and hornet and report it to the server, which will then report it to us via the web UI.

I'll leave that for another day and another blog post, as I'll need some help from the resident artist here to take video of the process Smiley cat

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube