Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pseudo_image
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
Léo Schneider
pseudo_image
Commits
ab986e15
Commit
ab986e15
authored
1 week ago
by
Schneider Leo
Browse files
Options
Downloads
Patches
Plain Diff
fix : ray base
parent
98919415
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
image_ref/main.py
+10
-1
10 additions, 1 deletion
image_ref/main.py
main_ray.py
+1
-1
1 addition, 1 deletion
main_ray.py
with
11 additions
and
2 deletions
image_ref/main.py
+
10
−
1
View file @
ab986e15
...
@@ -22,6 +22,9 @@ def train_duo(model, data_train, optimizer, loss_function, epoch, wandb):
...
@@ -22,6 +22,9 @@ def train_duo(model, data_train, optimizer, loss_function, epoch, wandb):
param
.
requires_grad
=
True
param
.
requires_grad
=
True
for
imaer
,
imana
,
img_ref
,
label
in
data_train
:
for
imaer
,
imana
,
img_ref
,
label
in
data_train
:
imaer
=
imaer
.
float
()
imana
=
imana
.
float
()
img_ref
=
img_ref
.
float
()
label
=
label
.
long
()
label
=
label
.
long
()
if
torch
.
cuda
.
is_available
():
if
torch
.
cuda
.
is_available
():
imaer
=
imaer
.
cuda
()
imaer
=
imaer
.
cuda
()
...
@@ -55,6 +58,9 @@ def val_duo(model, data_test, loss_function, epoch, wandb):
...
@@ -55,6 +58,9 @@ def val_duo(model, data_test, loss_function, epoch, wandb):
param
.
requires_grad
=
False
param
.
requires_grad
=
False
for
imaer
,
imana
,
img_ref
,
label
in
data_test
:
for
imaer
,
imana
,
img_ref
,
label
in
data_test
:
imaer
=
imaer
.
float
()
imana
=
imana
.
float
()
img_ref
=
img_ref
.
float
()
imaer
=
imaer
.
transpose
(
0
,
1
)
imaer
=
imaer
.
transpose
(
0
,
1
)
imana
=
imana
.
transpose
(
0
,
1
)
imana
=
imana
.
transpose
(
0
,
1
)
img_ref
=
img_ref
.
transpose
(
0
,
1
)
img_ref
=
img_ref
.
transpose
(
0
,
1
)
...
@@ -107,7 +113,7 @@ def run_duo(args):
...
@@ -107,7 +113,7 @@ def run_duo(args):
# load model
# load model
model
=
Classification_model_duo_contrastive
(
model
=
args
.
model
,
n_class
=
2
)
model
=
Classification_model_duo_contrastive
(
model
=
args
.
model
,
n_class
=
2
)
model
.
double
()
model
.
float
()
# load weight
# load weight
if
args
.
pretrain_path
is
not
None
:
if
args
.
pretrain_path
is
not
None
:
print
(
'
Model weight loaded
'
)
print
(
'
Model weight loaded
'
)
...
@@ -197,6 +203,9 @@ def make_prediction_duo(model, data, f_name, f_name2):
...
@@ -197,6 +203,9 @@ def make_prediction_duo(model, data, f_name, f_name2):
soft_max
=
nn
.
Softmax
(
dim
=
1
)
soft_max
=
nn
.
Softmax
(
dim
=
1
)
# iterate over test data
# iterate over test data
for
imaer
,
imana
,
img_ref
,
label
in
data
:
for
imaer
,
imana
,
img_ref
,
label
in
data
:
imaer
=
imaer
.
float
()
imana
=
imana
.
float
()
img_ref
=
img_ref
.
float
()
imaer
=
imaer
.
transpose
(
0
,
1
)
imaer
=
imaer
.
transpose
(
0
,
1
)
imana
=
imana
.
transpose
(
0
,
1
)
imana
=
imana
.
transpose
(
0
,
1
)
img_ref
=
img_ref
.
transpose
(
0
,
1
)
img_ref
=
img_ref
.
transpose
(
0
,
1
)
...
...
This diff is collapsed.
Click to expand it.
main_ray.py
+
1
−
1
View file @
ab986e15
...
@@ -20,7 +20,7 @@ def train_model(config,args):
...
@@ -20,7 +20,7 @@ def train_model(config,args):
# load data
# load data
data_train
,
data_test
=
load_data_duo
(
dat
ase
t
_dir
=
args
.
dataset_dir
,
data_train
,
data_test
=
load_data_duo
(
b
ase_dir
=
args
.
dataset_dir
,
batch_size
=
args
.
batch_size
,
batch_size
=
args
.
batch_size
,
noise_threshold
=
config
[
'
noise
'
],
noise_threshold
=
config
[
'
noise
'
],
)
)
...
...
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