Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
iamap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AMAP
iamap
Commits
bc388f6c
Commit
bc388f6c
authored
7 months ago
by
paul.tresson_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
have pre-selected backbone options rather than typing timm arch names. resolves #7
parent
371c83da
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
encoder.py
+39
-5
39 additions, 5 deletions
encoder.py
with
39 additions
and
5 deletions
encoder.py
+
39
−
5
View file @
bc388f6c
...
...
@@ -69,6 +69,7 @@ class EncoderAlgorithm(QgsProcessingAlgorithm):
BATCH_SIZE
=
'
BATCH_SIZE
'
CUDA_ID
=
'
CUDA_ID
'
BACKBONE_CHOICE
=
'
BACKBONE_CHOICE
'
BACKBONE_OPT
=
'
BACKBONE_OPT
'
MERGE_METHOD
=
'
MERGE_METHOD
'
WORKERS
=
'
WORKERS
'
PAUSES
=
'
PAUSES
'
...
...
@@ -205,13 +206,36 @@ class EncoderAlgorithm(QgsProcessingAlgorithm):
defaultValue
=
True
)
)
self
.
backbone_opt
=
[
'
ViT base DINO
'
,
'
ViT tiny Imagenet (smallest)
'
,
'
ViT base MAE
'
,
'
SAM
'
,
'
--Empty--
'
]
self
.
timm_backbone_opt
=
[
'
vit_base_patch16_224.dino
'
,
'
vit_tiny_patch16_224.augreg_in21k
'
,
'
vit_base_patch16_224.mae
'
,
'
samvit_base_patch16.sa1b
'
,
]
self
.
addParameter
(
QgsProcessingParameterEnum
(
name
=
self
.
BACKBONE_OPT
,
description
=
self
.
tr
(
"
Pre-selected backbones if you don
'
t know what to pick
"
),
defaultValue
=
0
,
options
=
self
.
backbone_opt
,
)
)
self
.
addParameter
(
QgsProcessingParameterString
(
name
=
self
.
BACKBONE_CHOICE
,
description
=
self
.
tr
(
'
Backbone choic
e (see huggingface.co/timm/)
'
),
defaultValue
=
'
vit_base_patch16_224.dino
'
,
# defaultValue = 'vit_small_patch16_224.dino'
,
'
Enter a architecture name if you want to test another backbon
e (see huggingface.co/timm/)
'
),
defaultValue
=
None
,
optional
=
True
,
)
)
...
...
@@ -571,9 +595,19 @@ class EncoderAlgorithm(QgsProcessingAlgorithm):
ckpt_path
=
self
.
parameterAsFile
(
parameters
,
self
.
CKPT
,
context
)
self
.
backbone_name
=
self
.
parameterAsString
(
## Use the given backbone name is any, use preselected models otherwise.
input_name
=
self
.
parameterAsString
(
parameters
,
self
.
BACKBONE_CHOICE
,
context
)
if
input_name
:
self
.
backbone_name
=
input_name
else
:
backbone_idx
=
self
.
parameterAsEnum
(
parameters
,
self
.
BACKBONE_OPT
,
context
)
self
.
backbone_name
=
self
.
timm_backbone_opt
[
backbone_idx
]
feedback
.
pushInfo
(
f
'
self.backbone_name:
{
self
.
backbone_name
}
'
)
self
.
stride
=
self
.
parameterAsInt
(
parameters
,
self
.
STRIDE
,
context
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment