I want to test my pre-trained model on a video. when I set the num_workers>0, my loaded data is chaotic after read each video image. I need to crop the full resolution image into three small regions with fixed coordinate. when I load data with  num_workers>0, the returned data is different position cropped.  This makes me confused.
my specific dataset is :
> #coding:utf8
import os
from PIL import Image
import numpy as np
from torch.utils import data 
from torchvision import transforms as T 
import string
import imageio
from torch.utils.data import DataLoader

class videoDataset(data.Dataset):
    def __init__(self,root='./',transform=None,DataType='train'):
        super(videoDataset,self).__init__()
        videopath='video2.avi'
        self.vid=imageio.get_reader(videopath,'ffmpeg')
        self.referenceimg="./myData/new_cam6d/c22/reference"
        
        self.para={'1':(384,90,768,218),'2':(444,218,1212,474),'3':(384,568,1920,1080)}
        
        if transform is None:
            self.transforms = T.Compose(
                [T.ToTensor(),
                T.Normalize((0.5, 0.5, 0.5,0.5,0.5,0.5), (0.5, 0.5, 0.5,0.5,0.5,0.5))])
                
    def __getitem__(self,index):
        self.ref1=Image.open('C0022_1.jpg')
        self.ref2=Image.open('C0022_2.jpg')   
        self.ref3=Image.open('C0022_3.jpg')
        
        
        data=self.vid.get_data(index)
        data=Image.fromarray(data)
        img1=data.crop(self.para['1'])
        size=img1.size
        #print(np.array(img1).shape, np.array(self.ref1).shape)
        arr1=np.concatenate((np.array(img1), np.array(self.ref1)), axis=2) #将
        img2=data.crop(self.para['2'])
        img2=img2.resize(size)
        arr2=np.concatenate((np.array(img2), np.array(self.ref2)), axis=2)
        img3=data.crop(self.para['3'])
        img3=img3.resize(size)
        arr3=np.concatenate((np.array(img3), np.array(self.ref3)), axis=2)
        arr=np.concatenate((arr1, arr2, arr3), axis=1)
        finalImg=self.transforms(arr)
       
        return finalImg,index
    def __len__(self):
        img_nums=self.vid.get_length()
        return img_nums