pingmapper 5.3.0__tar.gz → 5.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pingmapper-5.3.0 → pingmapper-5.3.1}/PKG-INFO +1 -1
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/funcs_model.py +59 -1
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/main_readFiles.py +1 -22
- pingmapper-5.3.1/pingmapper/version.py +1 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper.egg-info/PKG-INFO +1 -1
- pingmapper-5.3.0/pingmapper/version.py +0 -1
- {pingmapper-5.3.0 → pingmapper-5.3.1}/LICENSE +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/README.md +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/__init__.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/__main__.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/class_mapSubstrateObj.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/class_portstarObj.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/class_rectObj.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/class_sonObj.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/class_sonObj_nadirgaptest.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/default_params.json +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/doWork.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/funcs_common.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/funcs_rectify.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/gui_main.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/main_mapSubstrate.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/main_rectify.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/processing_scripts/main_batchDirectory_2024-01-18_0926.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/processing_scripts/main_batchDirectory_2024-01-18_0929.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/scratch/funcs_pyhum_correct.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/scratch/main.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/scratch/main_batchDirectory.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/test_PINGMapper.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/test_time.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/DRAFT_Workflows/avg_predictions_Mussel_WBL.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/DRAFT_Workflows/gen_centerline.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/DRAFT_Workflows/gen_centerline_from_bankline.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/DRAFT_Workflows/gen_centerline_trkpnts_fitspline_DRAFT.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/DRAFT_Workflows/testEXAMPLE_mosaic_logit.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/RawEGN_avg_predictions.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/Substrate_Summaries/00_substrate_logits_mosaic_transects.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/Substrate_Summaries/00_substrate_shps_mosaic_transects.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/Substrate_Summaries/01_gen_centerline_from_coverage.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/Substrate_Summaries/02_gen_summary_stamp_shps.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/Substrate_Summaries/03_gen_summary_shp.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/Substrate_Summaries/04_combine_summary_shp_csv.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/Substrate_Summaries/05_gen_summary_shp_plots.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/Substrate_Summaries/06_compare_raw-egn_volume.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/Substrate_Summaries/08_raw-egn_hardReacheFreq_hist.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/Substrate_Summaries/09_raw-egn_PatchSize_density.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/Substrate_Summaries/summarize_project_substrate.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/export_coverage.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/main_mosaic_transects.py +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper.egg-info/SOURCES.txt +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper.egg-info/dependency_links.txt +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper.egg-info/requires.txt +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper.egg-info/top_level.txt +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/pyproject.toml +0 -0
- {pingmapper-5.3.0 → pingmapper-5.3.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pingmapper
|
|
3
|
-
Version: 5.3.
|
|
3
|
+
Version: 5.3.1
|
|
4
4
|
Summary: Open-source interface for processing recreation-grade side scan sonar datasets and reproducibly mapping benthic habitat
|
|
5
5
|
Author: Daniel Buscombe
|
|
6
6
|
Author-email: Cameron Bodine <bodine.cs@gmail.email>
|
|
@@ -42,6 +42,14 @@ from pingmapper.funcs_common import *
|
|
|
42
42
|
quiet_tensorflow_warnings()
|
|
43
43
|
import json
|
|
44
44
|
import numpy as np
|
|
45
|
+
|
|
46
|
+
# Prevent the transformers/huggingface_hub libraries from making network calls
|
|
47
|
+
# to huggingface.co to check for model updates. The model weights are stored
|
|
48
|
+
# locally, so no internet access is needed. These flags can also be set as
|
|
49
|
+
# system environment variables (TRANSFORMERS_OFFLINE=1, HF_HUB_OFFLINE=1)
|
|
50
|
+
# before launching PINGMapper to achieve the same effect without a code change.
|
|
51
|
+
os.environ.setdefault("TRANSFORMERS_OFFLINE", "1")
|
|
52
|
+
os.environ.setdefault("HF_HUB_OFFLINE", "1")
|
|
45
53
|
# import tensorflow as tf
|
|
46
54
|
# import tensorflow.keras.backend as K
|
|
47
55
|
# from tensorflow.python.client import device_lib
|
|
@@ -114,6 +122,47 @@ Utilities provided courtesy Dr. Dan Buscombe from segmentation_gym
|
|
|
114
122
|
https://github.com/Doodleverse/segmentation_gym
|
|
115
123
|
'''
|
|
116
124
|
|
|
125
|
+
#=======================================================================
|
|
126
|
+
def _build_segformer_from_config(id2label, num_classes, num_channels=3):
|
|
127
|
+
'''
|
|
128
|
+
Construct a SegFormer model (nvidia/mit-b0 backbone architecture) entirely
|
|
129
|
+
from a hardcoded local config, without contacting HuggingFace Hub.
|
|
130
|
+
|
|
131
|
+
The config values below are the canonical mit-b0 architecture spec.
|
|
132
|
+
The backbone weights loaded here are random initialisation — they are
|
|
133
|
+
immediately overwritten by model.load_weights() with the Zenodo-hosted
|
|
134
|
+
fine-tuned weights, so no HF-sourced weights are ever used.
|
|
135
|
+
'''
|
|
136
|
+
from transformers import TFSegformerForSemanticSegmentation, SegformerConfig
|
|
137
|
+
|
|
138
|
+
label2id = {label: id for id, label in id2label.items()}
|
|
139
|
+
|
|
140
|
+
config = SegformerConfig(
|
|
141
|
+
num_channels=num_channels,
|
|
142
|
+
num_encoder_blocks=4,
|
|
143
|
+
depths=[2, 2, 2, 2],
|
|
144
|
+
sr_ratios=[8, 4, 2, 1],
|
|
145
|
+
hidden_sizes=[32, 64, 160, 256],
|
|
146
|
+
patch_sizes=[7, 3, 3, 3],
|
|
147
|
+
strides=[4, 2, 2, 2],
|
|
148
|
+
num_attention_heads=[1, 2, 5, 8],
|
|
149
|
+
mlp_ratios=[4, 4, 4, 4],
|
|
150
|
+
hidden_act='gelu',
|
|
151
|
+
hidden_dropout_prob=0.0,
|
|
152
|
+
attention_probs_dropout_prob=0.0,
|
|
153
|
+
classifier_dropout_prob=0.1,
|
|
154
|
+
initializer_range=0.02,
|
|
155
|
+
drop_path_rate=0.1,
|
|
156
|
+
layer_norm_eps=1e-06,
|
|
157
|
+
decoder_hidden_size=256,
|
|
158
|
+
semantic_loss_ignore_index=255,
|
|
159
|
+
num_labels=num_classes,
|
|
160
|
+
id2label=id2label,
|
|
161
|
+
label2id=label2id,
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
return TFSegformerForSemanticSegmentation(config)
|
|
165
|
+
|
|
117
166
|
#=======================================================================
|
|
118
167
|
def initModel(weights, configfile, USE_GPU=False):
|
|
119
168
|
'''
|
|
@@ -192,7 +241,16 @@ def initModel(weights, configfile, USE_GPU=False):
|
|
|
192
241
|
id2label = {}
|
|
193
242
|
for k in range(NCLASSES):
|
|
194
243
|
id2label[k]=str(k)
|
|
195
|
-
|
|
244
|
+
# SegFormer always uses 3 input channels: seg_file2tensor() converts
|
|
245
|
+
# single-channel images to 3-channel via np.dstack before inference,
|
|
246
|
+
# so the Zenodo weights are always saved with num_channels=3.
|
|
247
|
+
model = _build_segformer_from_config(id2label, NCLASSES, num_channels=3)
|
|
248
|
+
# Subclassed Keras models are lazy — variables don't exist until the
|
|
249
|
+
# first forward pass. Do a dummy call to build them so load_weights()
|
|
250
|
+
# can match the saved HDF5 file's variable names.
|
|
251
|
+
# Input to TFSegformer is NCHW: (batch, channels, height, width)
|
|
252
|
+
dummy = tf.zeros((1, 3, TARGET_SIZE[0], TARGET_SIZE[1]))
|
|
253
|
+
model(dummy, training=False)
|
|
196
254
|
|
|
197
255
|
model.load_weights(weights)
|
|
198
256
|
# model = compile_models([model[0]], MODEL)
|
|
@@ -303,28 +303,7 @@ def read_master_func(logfilename='',
|
|
|
303
303
|
modelDir = get_segmentation_model_dir()
|
|
304
304
|
if not os.path.exists(modelDir):
|
|
305
305
|
downloadSegmentationModelsv1_0(modelDir)
|
|
306
|
-
|
|
307
|
-
else:
|
|
308
|
-
getSegformer = False
|
|
309
|
-
|
|
310
|
-
###############
|
|
311
|
-
# Get segformer
|
|
312
|
-
if getSegformer:
|
|
313
|
-
NCLASSES = 8
|
|
314
|
-
id2label = {}
|
|
315
|
-
for k in range(NCLASSES):
|
|
316
|
-
id2label[k] = str(k)
|
|
317
|
-
|
|
318
|
-
# try downloading segformer pretrained model
|
|
319
|
-
try:
|
|
320
|
-
_ = segformer(id2label, NCLASSES)
|
|
321
|
-
except:
|
|
322
|
-
print('\n\n\n\n')
|
|
323
|
-
print('ERROR! Unable to download pretrained SegFormer model!')
|
|
324
|
-
print('Your network settings are blocking the download.')
|
|
325
|
-
print('Please try running on a different network.')
|
|
326
|
-
print('Once the script has been run successfully, you should be able')
|
|
327
|
-
print('to run PING-Mapper on the current network.')
|
|
306
|
+
|
|
328
307
|
|
|
329
308
|
|
|
330
309
|
###############################################
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '5.3.1'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pingmapper
|
|
3
|
-
Version: 5.3.
|
|
3
|
+
Version: 5.3.1
|
|
4
4
|
Summary: Open-source interface for processing recreation-grade side scan sonar datasets and reproducibly mapping benthic habitat
|
|
5
5
|
Author: Daniel Buscombe
|
|
6
6
|
Author-email: Cameron Bodine <bodine.cs@gmail.email>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '5.3.0'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/DRAFT_Workflows/avg_predictions_Mussel_WBL.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/DRAFT_Workflows/testEXAMPLE_mosaic_logit.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pingmapper-5.3.0 → pingmapper-5.3.1}/pingmapper/utils/Substrate_Summaries/03_gen_summary_shp.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|