Commit bd31e901 authored by E144069X's avatar E144069X

Fixed wrong path and missing return slot

parent b5c53abf
......@@ -34,17 +34,17 @@ maxTime = 200
def countFrames(videoPaths):
totalImgNb = 0
imgNbDict = {}
if not os.path.exists("../data/qual/frameNb.csv"):
if not os.path.exists("../data/frameNb.csv"):
frameNbArr = []
for videoPath in videoPaths:
nbImg = len(torchvision.io.read_video_timestamps(videoPath,pts_unit="sec")[0])
vidName = os.path.basename(videoPath)
frameNbArr.append((vidName,str(nbImg)))
frameNbArr = np.array(frameNbArr)
np.savetxt("../data/qual/frameNb.csv",frameNbArr,fmt="%s")
np.savetxt("../data/frameNb.csv",frameNbArr,fmt="%s")
totalImgNb = frameNbArr[:,1].astype("int").sum()
else:
frameNbArr = np.genfromtxt("../data/qual/frameNb.csv",dtype=str)
frameNbArr = np.genfromtxt("../data/frameNb.csv",dtype=str)
for videoPath in videoPaths:
vidName = os.path.basename(videoPath)
if vidName in frameNbArr[:,0]:
......@@ -53,7 +53,7 @@ def countFrames(videoPaths):
nbImg = len(torchvision.io.read_video_timestamps(videoPath,pts_unit="sec")[0])
frameNbArr = np.concatenate((frameNbArr,np.array([[vidName,str(nbImg)]])),axis=0)
totalImgNb += nbImg
np.savetxt("../data/qual/frameNb.csv",frameNbArr,fmt="%s")
np.savetxt("../data/frameNb.csv",frameNbArr,fmt="%s")
imgNbDict = {os.path.basename(videoPath):int(frameNbArr[frameNbArr[:,0] == os.path.basename(videoPath),1]) for videoPath in videoPaths}
return totalImgNb,imgNbDict
......@@ -123,7 +123,7 @@ class SeqTrDataset(torch.utils.data.Dataset):
self.origImgSize = origImgSize
if propStart != propEnd:
self.nbImages = countFrames(self.videoPaths)
self.nbImages,_ = countFrames(self.videoPaths)
self.resizeImage = resizeImage
......@@ -258,7 +258,7 @@ class TestLoader():
self.imgSize = imgSize
self.resizeImage = resizeImage
self.nbImages = countFrames(self.videoPaths)
self.nbImages,_ = countFrames(self.videoPaths)
if self.resizeImage:
self.reSizeTorchFunc = torchvision.transforms.Compose([torchvision.transforms.ToPILImage(),torchvision.transforms.Resize(imgSize)])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment