update
This commit is contained in:
Binary file not shown.
BIN
utils/__pycache__/getsource.cpython-39.pyc
Normal file
BIN
utils/__pycache__/getsource.cpython-39.pyc
Normal file
Binary file not shown.
@ -257,6 +257,8 @@ class LoadImages:
|
||||
videos = [x for x in files if x.split('.')[-1].lower() in VID_FORMATS]
|
||||
ni, nv = len(images), len(videos)
|
||||
|
||||
|
||||
|
||||
self.img_size = img_size
|
||||
self.stride = stride
|
||||
self.files = images + videos
|
||||
|
60
utils/getsource.py
Normal file
60
utils/getsource.py
Normal file
@ -0,0 +1,60 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Wed Oct 30 13:18:59 2024
|
||||
|
||||
@author: ym
|
||||
"""
|
||||
|
||||
import os
|
||||
import glob
|
||||
|
||||
IMGFORMATS = '.bmp', '.jpeg', '.jpg', 'png', 'tif', 'tiff', 'webp', 'pfm'
|
||||
VIDFORMATS = '.avi', '.gif', '.m4v', '.mkv', '.mov', '.mp4', '.ts', '.wmv'
|
||||
|
||||
def get_image_pairs(p):
|
||||
files = []
|
||||
files.extend(sorted(glob.glob(os.path.join(p, '*.jpg'))))
|
||||
# images = [x for x in files if x.split('.')[-1].lower() in IMG_FORMATS]
|
||||
|
||||
tamps_0, tamps_1 = [], []
|
||||
files_0, files_1 = [], []
|
||||
for file in files:
|
||||
basename = os.path.basename(file)
|
||||
if basename.find('frameId')<0: continue
|
||||
|
||||
|
||||
f, ext = os.path.splitext(basename)
|
||||
camer, tamp, _, frameId = f.split('_')
|
||||
|
||||
if camer == '0':
|
||||
tamps_0.append(int(tamp))
|
||||
files_0.append(file)
|
||||
|
||||
if camer == '1':
|
||||
tamps_1.append(int(tamp))
|
||||
files_1.append(file)
|
||||
|
||||
idx0 = sorted(range(len(tamps_0)), key=lambda k: tamps_0[k])
|
||||
files0 = [files_0[i] for i in idx0]
|
||||
|
||||
idx1 = sorted(range(len(tamps_1)), key=lambda k: tamps_1[k])
|
||||
files1 = [files_1[i] for i in idx1]
|
||||
|
||||
files = (files0, files1)
|
||||
|
||||
return files
|
||||
|
||||
|
||||
def get_video_pairs(vpath):
|
||||
vdieopath = []
|
||||
for filename in os.listdir(vpath):
|
||||
file, ext = os.path.splitext(filename)
|
||||
if ext in VIDFORMATS:
|
||||
vdieopath.append(os.path.join(vpath, filename))
|
||||
return vdieopath
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user