Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Informative and Representative Triplet Selection for Multi-Label Remote Sensing Image Retrieval
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
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RSiM
Informative and Representative Triplet Selection for Multi-Label Remote Sensing Image Retrieval
Commits
97084b0e
Commit
97084b0e
authored
3 years ago
by
Gencer Sumbul
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
1849a325
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
source/triplet_selection.py
+4
-4
4 additions, 4 deletions
source/triplet_selection.py
with
4 additions
and
4 deletions
source/triplet_selection.py
+
4
−
4
View file @
97084b0e
...
...
@@ -115,7 +115,7 @@ def select_triplets_with_threshold(label_distances, positive_threshold, negative
# create_positive_mask(positive_indices, batch_size),
# create_negative_mask(negative_indices, batch_size))
def
select_random_triplets
(
label_distances
,
num_elements
,
positive_threshold
=
0.
8
,
negative_threshold
=
0.
2
):
def
select_random_triplets
(
label_distances
,
num_elements
,
positive_threshold
=
0.
7
,
negative_threshold
=
0.
3
):
batch_size
=
len
(
label_distances
)
base_mask
=
np
.
ndarray
((
batch_size
,
batch_size
,
batch_size
),
dtype
=
bool
)
...
...
@@ -150,9 +150,9 @@ def select_random_triplets(label_distances, num_elements, positive_threshold=0.8
# negative_mask_temp[a, :, n] = label_distances[a, n] >= negative_threshold
if
label_distances
[
a
,
n
]
>
negative_threshold
:
neg_indices
.
append
(
n
)
import
ipdb
;
ipdb
.
set_trace
()
positive_mask
[
a
,
np
.
random
.
choice
(
pos_indices
,
size
=
num_elements
,
replace
=
Fals
e
),
:]
=
True
negative_mask
[
a
,
:,
np
.
random
.
choice
(
neg_indices
,
size
=
num_elements
,
replace
=
Fals
e
)]
=
True
#
import ipdb; ipdb.set_trace()
positive_mask
[
a
,
np
.
random
.
choice
(
pos_indices
,
size
=
num_elements
,
replace
=
Tru
e
),
:]
=
True
negative_mask
[
a
,
:,
np
.
random
.
choice
(
neg_indices
,
size
=
num_elements
,
replace
=
Tru
e
)]
=
True
return
tf
.
cast
(
tf
.
constant
(
np
.
logical_and
(
positive_mask
,
negative_mask
)),
tf
.
bool
)
...
...
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