Skip to main content

Interface for predicting and mapping benthic habitat (substrates) from any side-scan sonar mosaic.

Project description

RockMapper

🚧UNDER CONSTRUCTION🚧

PyPI - Version GitHub last commit GitHub commit activity GitHub

Interface for predicting and mapping benthic habitat (substrates) from any side-scan sonar mosaic.

Overview

RockMapper is an open-source Python interface for automatically predicting and mapping substrate types from and side-scan sonar mosaic(s). RockMapper leverages SegFormer pre-trained models fine-tuned with Segmentation Gym to automatically predict Paddlefish spawning habitat (manuscript forthcoming).

Published Documentation

Journal Article

Wolfenkoehler, Bodine, Long (forthcoming...)

Installation

  1. Install Miniforge.
  2. Open the Miniforge prompt.
  3. Install PINGInstaller:
    pip install --force-reinstall pinginstaller
    
  4. Install RockMapper.
    python -m pinginstaller rockmapper
    

Usage

  1. Copy the following script to some location on your computer:
'''
Copyright (c) 2025 Cameron S. Bodine
'''

#########
# Imports
import os, sys
import time, datetime

start_time = time.time()

# Set ROCKMAPPER utils dir
USER_DIR = os.path.expanduser('~')
GV_UTILS_DIR = os.path.join(USER_DIR, '.rockmapper')
if not os.path.exists(GV_UTILS_DIR):
    os.makedirs(GV_UTILS_DIR)

def gui():
    '''
    '''

    #################
    # NEED TO ADD GUI


    # FOR DEVELOPMENT
    #############################
    # Update Parameters
    seg_model = 'RockMapper_20250628_v1' # Don't update
    inDir = r'Z:\scratch\202506_BrushyDeepKiamichi_Substrate\mosaics'
    mosaicFileType = '.tif'
    outDirTop = r'Z:\scratch'
    projName = 'RockMapperTest'
    mapRast = False
    mapShp = True

    epsg = 32615

    windowSize_m = (18, 18)
    window_stride = 6
    minArea_percent = 0.75
    threadCnt = 0.75

    predBatchSize = 30

    minPatchSize_m2 = 18 # Minimum patch size to keep in final shapefile, in square meters
    smoothShp = True # Smooth final shapefile polygons
    smoothTol_m = 0.3 # Smoothing tolerance in meters, higher = more smoothing

    deleteIntData = True



    ################
    # Run HabiMapper

    modelDir = os.path.join(GV_UTILS_DIR, 'models')

    # RockMapper
    if seg_model == 'RockMapper_20250628_v1':
        from rockmapper.rock_mapper import do_work

        modelDir = os.path.join(modelDir, seg_model)


        print('\n\nMapping habitat with ROCKMAPPER model...\n\n')
        do_work(
        inDir = inDir,
        outDirTop = outDirTop,
        projName = projName,
        mapRast = mapRast,
        mapShp = mapShp,
        epsg = epsg,
        windowSize_m = windowSize_m,
        window_stride = window_stride,
        minArea_percent = minArea_percent,
        threadCnt = threadCnt,
        mosaicFileType=mosaicFileType, 
        modelDir=modelDir,
        predBatchSize=predBatchSize,
        deleteIntData=deleteIntData,
        minPatchSize = minPatchSize_m2,
        smoothShp = smoothShp,
        smoothTol_m = smoothTol_m,
        )





    print("\n\nGrand Total Processing Time: ", datetime.timedelta(seconds = round(time.time() - start_time, ndigits=0)))
    return

if __name__ == "__main__":
    gui()
  1. Open the file with Visual Studio Code.
  2. Update the Parameters as necessary:
#############################
# Update Parameters
seg_model = 'RockMapper_20250628_v1' # Don't update
inDir = r'Z:\scratch\202506_BrushyDeepKiamichi_Substrate\mosaics'
mosaicFileType = '.tif'
outDirTop = r'Z:\scratch'
projName = 'RockMapperTest'
mapRast = False
mapShp = True

epsg = 32615

windowSize_m = (18, 18)
window_stride = 6
minArea_percent = 0.75
threadCnt = 0.75

predBatchSize = 30

minPatchSize_m2 = 18 # Minimum patch size to keep in final shapefile, in square meters
smoothShp = True # Smooth final shapefile polygons
smoothTol_m = 0.3 # Smoothing tolerance in meters, higher = more smoothing

deleteIntData = True
  1. Ensure the rockmapper environment is selected as the Interpreter see this.
  2. Run the script in debug mode by pressing F5.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rockmapper-1.0.0a9.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rockmapper-1.0.0a9-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file rockmapper-1.0.0a9.tar.gz.

File metadata

  • Download URL: rockmapper-1.0.0a9.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for rockmapper-1.0.0a9.tar.gz
Algorithm Hash digest
SHA256 4f65f4739486ba985f420d219daed5be2d5527d2f4d90599dc931819c089f416
MD5 52e51ba676cf369811aca4f3482efb82
BLAKE2b-256 949770146ca57aaa14cc5123239c68ec2dbf7ae0f414b9e9e37f96a2558ed545

See more details on using hashes here.

File details

Details for the file rockmapper-1.0.0a9-py3-none-any.whl.

File metadata

  • Download URL: rockmapper-1.0.0a9-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for rockmapper-1.0.0a9-py3-none-any.whl
Algorithm Hash digest
SHA256 da5c57420c3a5d686966ddd7dd5acec1147c2bedc8bdc25bbf085d7322942fed
MD5 524ccf55575a701215d92875badf4cd4
BLAKE2b-256 e3211a9763d70e451f6619462aa194e57db32012e18c37a9310ede14e612de66

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page