New GRIME2 release with CLI generator

This release makes the creation of CLI calls much easier. The ROI’s and other parameters you select in the GUI can be used to create CLI parameters and output them as test to the textbox below the main image. There are two “Create command line” buttons: one on the Calibration tab and one on the Find Line tab.

https://github.com/gaugecam-dev/GRIME2/releases/tag/v0.3.0.8

Screenshot of the GRIME2 GUI showing the Create command line button and output in the Line Find tab.
Create command line button and output in the Line Find tab.

What time-lapse camera should I use for image-based hydrology with machine learning?

Planning ecological and/or hydrological research project using trail cams? If so, you might be wondering about which camera and mounting system to use. We have some ideas. But first, here are some helpful references from groups that have many years of experiences with camera traps and ecohydrological monitoring:

Learn from Andrew Richardson’s account of PhenoCam’s history and lessons learned from operating a large scientific camera network: https://doi.org/10.1016/j.agrformet.2023.109751

Get inspired by Platte Basin Timelapse’ artistic time-lapse camera network, oriented toward conservation storytelling in support of science: https://plattebasintimelapse.com/timelapses/

Explore streams and rivers on the United States Geological Survey’s HIVIS site: https://apps.usgs.gov/hivis/

Honestly, the groups above have more experience installing time-lapse cameras than we do. That said, we have been learning and are happy to share the approach we are now using at stream monitoring sites like the Kearney Outdoor Learning Area (KOLA).

The Camera:

Our current preference is the Reconyx Hyperfire 2 Professional camera.

Why “Professional”? These cameras are $60 more than the standard Hyperfire 2. Based on the Reconyx comparison tool, here are key differences.

Reconyx Hyperfire 2 Professional Camera front view
Reconyx Hyperfire
(source: www.reconyx.com)
  • Greater range of video length options
  • More frame rate options
  • More trigger delay options
  • Motion sensor scheduling
  • More time-lapse intervals and surveillance modes
  • Greater range of ISO and nighttime shutter settings
  • Higher/lower operating temperatures
  • Optional external power connector
  • Option for custom focal system
  • Optional external trigger
  • Software with more options

The Security Enclosure:

A good lock and security enclosure are important for most sites. But we also like the Reconyx security enclosure for another reason: image stability. Minimizing camera movement is one of the most important considerations for effective monitoring! Of course, a security enclosure does not guarantee a perfectly stable camera. But we like the way the enclosure can be mounted in a permanent position and the camera can be removed for maintenance and placed back in the security enclosure without large translational or rotational shifts in the field of view. We have used other cameras and mounting systems where the camera and/or mount has to be loosened or removed when swapping the SD card and/or changing batteries. When we re-attach the camera and/or mount, it’s a guessing game as to whether we’ve returned the camera to a position that captures even a similar field of view.

Reconyx security enclosures
Reconyx security enclosures as seen at https://www.reconyx.com/product/Security-Enclosure.

Other Accessories:

  • We are just now trying this heavy duty swivel mount: https://www.reconyx.com/product/Heavy-Duty-Swivel-Mount. We have heard good things about it and will update when we have more experience.
  • When using lithium AA batteries in a standalone camera, we have long camera run times. We are just getting acquainted with the cellular camera, which obviously requires more power. We have heard good things about Reconyx’s external power supply. It has a nice form factor, but it is pretty simple: a solar panel, charge controller, and replaceable battery. If you’re already great at setting up solar power and/or have the supplies in your lab, maybe you can save a little by doing it yourself. We’ll update here after we have some experience with this power supply: https://www.reconyx.com/product/solar-charger-10-watt.

Things we think you should NOT do:

Pretty please, do not just stick a t-post in the ground and attach a camera. You will get a lot of camera movement and it will make life more difficult when you want to process your images.

Do not just strap a camera on a tree. If you are using a tree and can’t use screws or lag bolts, then securely attach an enclosure (directly, or via swivel mount that is strapped to the tree). If you just strap the camera to a tree and then have to remove the strap and camera each time you swap an SD card and/or batteries, you will get a lot of camera movement and it will make life more difficult when you want to process your images.

In conclusion, we think the Reconyx camera is a good choice for our research projects. It is a relatively expensive option and much cheaper cameras might acquire imagery that is suitable for your work. We’d be happy to hear if there are other options that have worked well for you. When it’s all said and done, the best advice we can offer is to create a stable mounting system that minimizes changes in the field of view. Otherwise, you will get a lot of camera movement and it will make life more difficult when you want to process your images!

Water Level Camera: mini-octagon target test

This post describes the first testing of a mini-octagon calibration target for measuring water level with a camera and machine vision algorithms.

Image of three signs installed in a small stream. Each sign contains a blue octagon shape that is used to calibrate images for water level measurements.
Mini-octagon (center) is approximately eight inches across, leading to a much smaller footprint for the target background. The other two octagons in the image are printed on plexiglass backgrounds two feet in width. Image credit: Mary Harner

The original GaugeCam “bow-tie” calibration target was about three feet wide and four feet tall. This target yielded excellent calibration and precise water level readings. However, the size of the target is obtrusive in images and prohibitive at some sites.

The next generation calibration target, the “octagon target,” is approximately two feet wide. The benefits of the octagon are that (1) the target footprint is much smaller, and (2) the calibration target remains above the water line, so a calibration can be performed for every image. Calibrating each image is more robust because it accounts for camera movement, which is inevitable. The large octagon target performs on par with the original bow-tie calibration target, as shown in Ken Chapman’s dissertation.

Our goal with the mini-octagon is to reduce the target background to the minimal size required for robust calibration and water level measurement. The current size is larger than a traditional staff gauge but reasonable size for installation in many environments. Below you can see our field fabrication of the first mini-octagon, using a sheet of Coroplast, spray paint, and octagon stencil.

Initial tests show that our algorithms can detect the vertices of the mini-octagon in low-light conditions and under IR illumination.

Mini-octagon detection for image calibration. We are working to determine how much calibration precision is reduced by the smaller octagon.
The latest KOLA imagery can be found at https://apps.usgs.gov/hivis/camera/NE_Kearney_Outdoor_Learning_Area_RISE.

GRIME-AI: A Quick Check on Time Required for Accessing and Processing USGS HIVIS Imagery

This video shows steps and time required for data download and image analysis of over 5,000 images from a USGS HIVIS site on the Elkhorn River in Nebraska. The process includes setting regions of interest (ROIs) and extraction of color and other scalar image features suitable for machine learning applications. This work was done on a laptop computer running GRIME-AI v0.0.3.8c-003.

PROCESSES COMPLETED:

• Data selection

• Imagery download

• Stage and discharge data download

• Image processing

• Image feature dataset created

• Ready for data fusion, then ML modeling

LAPTOP SPECIFICATIONS:

Intel i7-9850H @ 2.60GHz 2.59GHz

32 GB RAM

NVIDIA GeForce GTX 1650

Home fiber internet connection over Wifi

TIME REQUIRED:

The overall process took 1:04 hours, including all download and processing time. Extrapolating, this suggests about 4:15 hours required to download and process one year’s worth of imagery when working in my home office.

GRIME-AI Open-Source Software for Analysis of Ground-based TIme-lapse Imagery for Ecohydrological Science

GRIME-AI v0.0.3.7 Camera Trap Software for Ecohydrology: Current and Future Features

GRIME-AI v0.0.3.7 image processing screen.

This post builds on our recent update about GRIME-AI capabilities. The previous post (and video) described features in GRIME-AI that are reasonably stable (although subject to occasional changes in APIs for public data sources). The description below is our current roadmap to a full GRIME-AI suite of tools for using imagery in ecohydrological studies. Please contact us if you see major gaps or are interested in helping us test the software as new features are developed!

The following features are implemented or planned for GRIME-AI:

You will notice asterisks that indicate *planned future functionality (timeframe = months to years) and **functionality under development (timeframe = weeks to months). All other features are developed, but subject to additional user testing as we work toward a stable public release. GRIME-AI is being developed open source commercial friendly (Apache 2.0).

  • Acquire PhenoCam imagery and paired NEON sensor data
  • Acquire USGS HIVIS imagery and paired stage, discharge and other sensor data
  • Data cleaning (image triage)
    • Automatically identify and remove low-information imagery
  • Data fusion*
    • Identify gaps in image and other sensor data*
    • Documented resolution of data gaps*
    • Documented data alignment criteria*
      • Choose precision for “paired” timestamps (e.g., +/- 5 min between image timestamp and other sensor data timestamp)*
  • Image analysis
    • Calculate and export scalar features for ML with low computational requirements
      • Image analysis algorithms include:
        • K-means color clustering (user selected, up to 8 clusters, HSV for each cluster)
        • Greenness index (PhenoCam approach)
        • Shannon Entropy
        • Intensity
        • Texture
    • Draw masks for training segmentation models**
      • Draw polygon shapes
      • Save masks and overlay images**
      • Export mask**
    • Image calibration and deterministic water level detection (currently a separate Windows installer called GRIME2, but we have command line to implement this in GRIME-AI)**
      • Draw calibration ROI for automatic detection of octagon calibration targets
      • Draw edge detection ROI for automatic detection of water edge
      • Enter reference water level and octagon facet length
      • Process image folders
        • Save overlay images
    • All scalar feature values, ROIs and polygon shapes exported as .csv and .json*
  • Data products and export*
    • Documentation of data source and user decisions, where final datasets include:
      • Metadata for all source data*
      • Documented user decisions from data cleaning and data fusion processes*
      • Documentation of calculated image features*
        • Sample image overlay showing location of ROIs*
        • Sample image showing segmentation masks and labels*
        • Coordinates and labels of all ROIs (.csv and .json)*
        • Breakpoints for major camera movement, image stabilization, or other major changes in imagery*
      • A .csv and a .json file with aligned, tidy data that is appropriate for training/testing ML models*
      • Metadata appropriate for storing final data product (scalar data only) in CUAHSI HydroShare or similar data repository*
      • Documentation of imagery source, including timestamps and metadata for original imagery retrieved from public archive*
  • Modeling and model outputs*
    • Build segmentation models (e.g., to automatically detect water surfaces in images)*
    • Build ML models from scalar image features and other sensor data and/or segmentation results*
    • Export model results, performance metrics, and metadata*

All of the above are being developed under the MESH development philosophy:

What does it take to install GaugeCam? Here are the gritty details and caveats.

Today I wrote a long email to a colleague interested in setting up GaugeCam. Why not share (a lightly-edited version) with the world?!

First, here’s a recent animation of me installing a target. This might take a moment to load.

animation of image-based water level camera installation
Installation of stop-sign target for GaugeCam water level measurement system.

Second, there are a number of additional resources available at https://gaugecam.org/grime2-details/, including this document that describes the installation details for a bowtie target at our North Carolina tidal marsh site: http://gaugecam.org/wp-content/uploads/2022/06/Gaugecam_org_background_installation_guideline.pdf.

A small photo gallery of a stop-sign target installation in Nebraska:

Some practical considerations and details:

  1. The first question that needs to be answered is the level of reliability and accuracy that is required for your application. If this is an easily-accessed (for maintenance) “demo” site, then this system is perfect for facilitating science communication, etc. If it’s a remote site, with only occasional access for maintenance and data collection, we strongly recommend putting in a cheap transducer alongside the GaugeCam system (e.g., HOBO, $300).
  2. Accuracy depends on (1) how many real-world mm or cm are represented by each pixel in the image, and (2) the quality of installation and maintenance of the background target. The following are issues to consider for field application:
    1. In controlled lab experiments, we can achieve high accuracy (+/- 3 mm, about the size of a meniscus; see Gilmore et al. 2013).
    2. In a carefully maintained tidal marsh installation, accuracy was less, but still quite good (see Birgand et al. 2022).
    3. You will encounter foggy mornings, spider webs on lens, and other similar environmental issues when using cameras. Expect data gaps of minutes to hours due to these issues.
    4. While biofouling is a universal problem for many reasons for many applications and industries, we are actively working to mitigate biofouling affects in our application. In the nutrient-rich agricultural streams where we work, biofouling accumulates within 7-10 days, which requires regular cleaning.
    5. The background must be plumb (perpendicular to the water surface).
    6. The original bow-tie target (template here, nominally 3’ x 4’) was used in the studies above. The new stop-sign target (template here, nominally 2’ x 4’) is experimental, but is smaller and still seems to give pretty good results. The bow-tie requires a survey of the real-world location of bowtie intersections. The stop-sign target requires only the facet length measurement (assumed to be the same for all 8 facets on the printed target) and reference measurement from the bottom left corner.
  3. In terms of installation, here is a parts list from my recent installations in sandy to slightly gravelly streambeds:
    1. Target
      1. Target background, matte print laminated on plexiglass*
      2. Two treated 4×4 posts, 8’ long [NOTE: before digging post holes you should have utilities located; contact your local utilities for this (usually free) service!]
      3. Two treated 2×4 boards, 8’ long
      4. Two Post- Base Spike for 4×4 Nominal Lumber**
      5. One ¾” treated sheet of plywood***
      6. Short (1” or 1 ¼”) pan-head screws (for attaching the plexiglass to the plywood)
      7. Long (3”) outdoor decking screws
      8. Thin wood wedges or spacers (for adjusting background so it is plumb – you might be able to cut these in the field)
    2. Camera
      1. We suggest Reconyx cameras due to their quality, though nearly any game camera will do
      2. Suggest RAM mount products to minimize any camera movement (example 1, example 2)
      3. Suggest adding a lock on camera for security
      4. Suggest treated 4×6 post for mounting the camera; 4×4 post as very minimum.
      5. Camera can be mounted on a large tree or similar, but this will usually create a good bit of movement of the camera. Small amounts of movement can be handled by the software, but minimal movement is better.
    3. Tools that you need (at the very minimum)
      1. Sledge hammer
      2. Post hole digger
      3. Cordless drill
      4. Cordless saw(s) (at least a reciprocating saw)
      5. Level
      6. Measuring tape
      7. Screwdriver

*We are looking for a better alternative that does not require as much cleaning and/or is more resistant to biofouling. The matte finish seems like a good attachment surface for biofouling. If you find a local sign shop for printing, I can send you the contact info for my sign shop so they can talk.

**I have used these in the sandy streams, where I cannot dig holes more than ~1 ft into the streambed (the sand collapses in), so adding these spikes on the bottom helps solidify the installation.

***You can print the background on very thick plexiglass and skip the plywood, but I found this to be expensive. So I printed on ¼” plexiglass and mounted on plywood backing.