Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OIR anisotropy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
lewa
OIR anisotropy
Commits
e2e76adc
Commit
e2e76adc
authored
2 years ago
by
lewa
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parents
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
feature_extract.py
+32
-0
32 additions, 0 deletions
feature_extract.py
with
32 additions
and
0 deletions
feature_extract.py
0 → 100644
+
32
−
0
View file @
e2e76adc
import
numpy
as
np
from
kit.mics
import
*
import
json
from
tqdm.auto
import
tqdm
counts
=
0
data_path
=
'
data/
'
results_path
=
'
results/
'
pic_dict
=
np
.
load
(
os
.
path
.
join
(
data_path
,
'
materials_pic.npz
'
),
allow_pickle
=
True
)[
'
materials_pic
'
].
item
()
isolabel
=
json
.
load
(
open
(
os
.
path
.
join
(
data_path
,
'
isolabel.json
'
)))
csv_folder
=
'
extracted_features/
'
name_list
=
[
x
.
split
(
"
.
"
)[
0
]
for
x
in
os
.
listdir
(
os
.
path
.
join
(
data_path
,
csv_folder
))]
new_material
=
[]
for
key
in
pic_dict
.
keys
():
if
key
not
in
name_list
:
new_material
.
append
(
key
)
for
n
,
key
in
enumerate
(
tqdm
(
new_material
)):
results_array
=
np
.
empty
((
0
,
14
))
# new empty array for each new material
counts
=
0
for
k
in
tqdm
(
range
(
20
),
leave
=
False
):
#data aug
tf
=
0
if
k
==
0
else
1
for
j
,
img
in
enumerate
(
pic_dict
[
key
]):
tmp
=
get_ae_2d
(
img
,
key
,
isolabel
[
key
],
j
+
counts
,
tf
)
results_array
=
np
.
vstack
((
results_array
,
tmp
))
counts
+=
pic_dict
[
key
].
shape
[
0
]
all_aug_df
=
pd
.
DataFrame
(
results_array
)
all_aug_df
.
columns
=
[
'
Sample No
'
,
"
Material
"
,
"
Layer
"
,
"
Intensity
"
,
'
Intensity_index
'
,
'
Eccentricity
'
,
'
Ellipse angle
'
,
'
pca_eps
'
,
'
pca_angle
'
,
'
isotropy label
'
,
'
blur
'
,
'
transform
'
,
'
evr1
'
,
'
evr2
'
]
all_aug_df
.
to_csv
((
os
.
path
.
join
(
data_path
,
f
'
{
csv_folder
}{
key
}
.csv
'
)))
\ 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
register
or
sign in
to comment