Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
ljsctc
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
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Raymond Yung
ljsctc
Commits
79258c86
Commit
79258c86
authored
Feb 25, 2020
by
ac32
Browse files
Options
Downloads
Patches
Plain Diff
modified importExport and optimize for evalRC
parent
076a4ea9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ctc/importExport/importExport.m
+18
-10
18 additions, 10 deletions
ctc/importExport/importExport.m
ctcOptimize/ctcEval1.m
+20
-36
20 additions, 36 deletions
ctcOptimize/ctcEval1.m
ctcOptimize/evalRC.m
+21
-0
21 additions, 0 deletions
ctcOptimize/evalRC.m
with
59 additions
and
46 deletions
ctc/importExport/importExport.m
+
18
−
10
View file @
79258c86
...
...
@@ -71,7 +71,8 @@ MicroscopeData.WriterH5(im,'imageData',imd,'path',outfolder);
function
export
(
filename
,
outpath
,
gtFile
)
[
~
,
exp
,
~
]
=
fileparts
(
filename
);
tokens
=
regexp
(
exp
,
'(\D+)_(\d+)'
,
'tokens'
);
exp
=
strrep
(
exp
,
'_training'
,
''
);
tokens
=
regexp
(
exp
,
'(.+)_(\d\d)'
,
'tokens'
);
dsName
=
tokens
{
1
}{
1
};
dsID
=
tokens
{
1
}{
2
};
% strip off the _01 or _02 of the exp
...
...
@@ -81,11 +82,11 @@ else
subdir
=
'02_RES'
;
end
% exp=exp(1:end-3);
outpath
=
fullfile
(
outpath
,
exp
,
subdir
);
if
~
exist
(
outpath
,
'dir'
)
m
k
dir
(
outpath
);
outpath
=
fullfile
(
outpath
,
dsName
,
subdir
);
if
exist
(
outpath
,
'dir'
)
r
mdir
(
outpath
,
's'
);
end
mkdir
(
outpath
);
fprintf
(
1
,
'exporting to folder %s\n'
,
outpath
);
conn
=
database
(
filename
,
''
,
''
,
'org.sqlite.JDBC'
,
'jdbc:sqlite:'
);
...
...
@@ -189,6 +190,9 @@ if size(tids,1)>1
else
tidString
=
[
'('
jsonencode
(
tids
(
1
))
')'
];
end
tDigits
=
ceil
(
log10
(
CONSTANTS
.
imageData
.
NumberOfFrames
));
tDigits
=
max
(
tDigits
,
3
);
digitFormat
=
[
'%0'
num2str
(
tDigits
)
'd'
];
for
t
=
1
:
CONSTANTS
.
imageData
.
NumberOfFrames
tImageLabels
=
[
0
];
% make sure no one gets over written
% NOTE -- add segCC asc as there is an issue with segCC's of -1 (from
...
...
@@ -210,7 +214,7 @@ for t=1:CONSTANTS.imageData.NumberOfFrames
end
im
=
setMissingTrackLabels
(
conn
,
im
,
tids
,
t
);
fname
=
[
'mask'
num2str
(
t
-
1
,
'%03d'
)
'.tif'
];
fname
=
[
'mask'
num2str
(
t
-
1
,
digitFormat
)
'.tif'
];
im
=
uint16
(
im
);
if
size
(
im
,
3
)
>
1
imwrite
(
im
(:,:,
1
),
fullfile
(
outpath
,
fname
));
...
...
@@ -272,10 +276,14 @@ for i=1:length(idsMissing)
cxInterp
=
round
(
cxInterp
);
if
length
(
size
(
im
))
<
3
cxInterp
=
cxInterp
(
1
:
2
);
end
cxInterp
=
min
(
cxInterp
,[
size
(
im
,
2
);
size
(
im
,
1
)]);
cxInterp
=
max
(
cxInterp
,
ones
(
length
(
cxInterp
),
1
));
im
(
cxInterp
(
2
),
cxInterp
(
1
))
=
idsMissing
(
i
);
else
cxInterp
=
min
(
cxInterp
,[
size
(
im
,
2
);
size
(
im
,
1
);
size
(
im
,
3
)]);
cxInterp
=
max
(
cxInterp
,
ones
(
length
(
cxInterp
),
1
));
im
(
cxInterp
(
2
),
cxInterp
(
1
),
cxInterp
(
3
))
=
idsMissing
(
i
);
end
end
...
...
This diff is collapsed.
Click to expand it.
ctcOptimize/ctcEval1.m
+
20
−
36
View file @
79258c86
...
...
@@ -9,43 +9,32 @@ path(path,fullfile(thisFolder,'..','ctc/importExport'));
outfolder
=
fullfile
(
evalFolder
,
'eval'
);
% results file
if
~
exist
(
'./evalScore'
,
'dir'
)
mkdir
(
'./evalScore'
);
end
idxParam
=
strfind
(
targetName
,
'_param'
);
if
~
isempty
(
idxParam
)
strResults
=
targetName
(
1
:
idxParam
-
1
);
else
strResults
=
targetName
;
end
strResults
=
fullfile
(
'./evalScore'
,[
strResults
'_res.txt'
]);
if
exist
(
strResults
,
'file'
)
res
=
readtable
(
strResults
,
'delimiter'
,
','
);
else
res
=
[];
end
fname
=
strDB
;
fname
=
strrep
(
fname
,
'_training'
,
''
);
tokens
=
regexp
(
targetName
,
'(.*)_training_(\d\d)'
,
'tokens'
);
if
isempty
(
tokens
)
fprintf
(
2
,
'file %s training info not found - skipping \n'
,
strDB
);
return
end
dsName
=
tokens
{
1
}{
1
};
dsID
=
tokens
{
1
}{
2
};
importExport
(
strDB
,
outfolder
,
[])
% copy over the ground truth
gtTarget
=
fullfile
(
outfolder
,
dsName
,[
dsID
'_GT'
]);
if
~
exist
(
gtTarget
,
'dir'
)
gtSource
=
fullfile
(
gtPath
,[
'2d_'
dsName
'_training'
],
dsName
,[
dsID
'_GT'
]);
if
~
exist
(
gtSource
,
'dir'
)
gtSource
=
fullfile
(
gtPath
,[
'3d_'
dsName
'_training'
],
dsName
,[
dsID
'_GT'
]);
end
if
~
exist
(
gtSource
,
'dir'
)
fprintf
(
2
,
'ground truth not found, skipping : %s\n'
,
gtSource
);
return
end
copyfile
(
gtSource
,
gtTarget
);
end
copyfile
(
gtSource
,
fullfile
(
outfolder
,
targetName
,[
dsID
'_GT'
]),
'f'
);
if
ispc
TRA
=
'TRAMeasure.exe'
;
...
...
@@ -60,13 +49,13 @@ else
end
system
([
fullfile
(
exePath
,
TRA
)
' '
...
fullfile
(
outfolder
,
target
Name
)
' '
dsID
' > score.txt'
]);
fullfile
(
outfolder
,
ds
Name
)
' '
dsID
' > score.txt'
]);
system
([
fullfile
(
exePath
,
SEG
)
' '
...
fullfile
(
outfolder
,
target
Name
)
' '
dsID
' >> score.txt'
]);
fullfile
(
outfolder
,
ds
Name
)
' '
dsID
' >> score.txt'
]);
system
([
fullfile
(
exePath
,
DET
)
' '
...
fullfile
(
outfolder
,
target
Name
)
' '
dsID
' >> score.txt'
]);
fullfile
(
outfolder
,
ds
Name
)
' '
dsID
' >> score.txt'
]);
fid
=
fopen
(
'score.txt'
);
scoreTxt
=
fscanf
(
fid
,
'%s'
);
...
...
@@ -80,14 +69,9 @@ fprintf(1,'TRAmeasure:%f, SEGmeasure:%f, DETmeasure:%f\n',sx(1),sx(2),sx(3));
[
conn
,
CONSTANTS
]
=
openDB
(
strDB
);
segParams
=
Read
.
getSegmentationParams
(
conn
);
if
isempty
(
res
)
res
=
table
(
sx
(
1
),
sx
(
2
),
sx
(
3
),{
jsonencode
(
segParams
)},
'VariableNames'
,{
'TRA'
,
'SEG'
,
'DET'
,
'segParams'
});
else
res
=
[
res
;
sx
(
1
),
sx
(
2
),
sx
(
3
),{
jsonencode
(
segParams
)}];
end
close
(
conn
);
writetable
(
res
,
strResults
);
This diff is collapsed.
Click to expand it.
ctcOptimize/evalRC.m
0 → 100644
+
21
−
0
View file @
79258c86
% eval all the datasets in the release folder
ROOT
=
'/f/leverjs/ctc2020rc'
flist
=
dir
(
fullfile
(
ROOT
,
'**/*training*.LEVER'
));
results
=
[];
for
ff
=
1
:
length
(
flist
)
if
strcmp
(
flist
(
ff
)
.
name
(
1
:
2
),
'BF'
)
continue
end
strDB
=
fullfile
(
flist
(
ff
)
.
folder
,
flist
(
ff
)
.
name
);
res
=
ctcEval1
(
strDB
);
% drop the segparams
res
=
res
(
1
,
1
:
3
);
res
=
[{
datetime
},{
strDB
},
res
];
res
.
Properties
.
VariableNames
{
1
}
=
'date-time'
;
res
.
Properties
.
VariableNames
{
2
}
=
'strDB'
;
results
=
[
results
;
res
]
end
writetable
(
results
,
'/f/leverjs/ctc2020rc/results.txt'
)
\ No newline at end of file
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
sign in
to comment