Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90717711
Anchor.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Nov 4, 03:32
Size
654 B
Mime Type
text/x-python
Expires
Wed, Nov 6, 03:32 (2 d)
Engine
blob
Format
Raw Data
Handle
22124319
Attached To
R11789 DED Contrastive Learning
Anchor.py
View Options
import
matplotlib.pyplot
as
plt
import
numpy
as
np
from
PIL
import
Image
import
glob
path
=
r'C:\Users\srpv\Desktop\Publication Ready\DED\Code\Folder_Siamese\Data\2'
# use your path
all_files
=
glob
.
glob
(
path
+
"/*.png"
)
ims
=
[]
for
filename
in
all_files
:
print
(
filename
)
ims
.
append
(
Image
.
open
(
filename
,
mode
=
'r'
))
ims
=
np
.
array
([
np
.
array
(
im
)
for
im
in
ims
])
imave
=
np
.
average
(
ims
,
axis
=
0
)
print
(
imave
.
shape
)
result
=
Image
.
fromarray
(
imave
.
astype
(
'uint8'
))
result
.
save
(
'C:/Users/srpv/Desktop/Publication Ready/DED/Code/Folder_Siamese/Anchor/Normal/result.png'
)
plt
.
figure
(
figsize
=
(
20
,
4
))
plt
.
imshow
(
np
.
transpose
(
result
,
(
0
,
1
,
2
)))
Event Timeline
Log In to Comment