You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def read_images(img_dir):
...
file_list = [f for f in os.listdir(img_dir) if os.path.isfile(os.path.join(img_dir, f))]
frames_list = [file for file in file_list if ('_L' not in file) and ('txt' not in file)]
masks_list = [file for file in file_list if ('_L' in file) and ('txt' not in file)]
adding
for i in range(10):
print(f"{frames_list[i]} and {masks_list[i]}")
will demonstrate the items can arrive out of order, as they did on my system.
0016E5_08115.png and 0016E5_08031_L.png
0016E5_08075.png and 0016E5_08007_L.png
0016E5_08001.png and 0016E5_08147_L.png
0016E5_07991.png and 0016E5_08107_L.png
0016E5_08157.png and 0016E5_08013_L.png
0016E5_08023.png and 0016E5_08111_L.png
0016E5_07963.png and 0016E5_07975_L.png
0016E5_08015.png and 0016E5_08067_L.png
0016E5_08139.png and 0016E5_07961_L.png
0016E5_08061.png and 0016E5_08149_L.png
a brute force fix
masks_list = []
frames_list = []
for file in file_list:
if ('_L' in file) and ('txt' not in file):
index = file.rfind(".")
frame_file = file[:index-2]+file[index:]
if os.path.isfile(os.path.join(img_dir, frame_file)):
masks_list.append(file)
frames_list.append(frame_file)
The text was updated successfully, but these errors were encountered:
adding
will demonstrate the items can arrive out of order, as they did on my system.
a brute force fix
The text was updated successfully, but these errors were encountered: