Best Python code snippet using lettuce_webdriver_python
dataset.py
Source:dataset.py
1from jittor.dataset.dataset import Dataset2import matplotlib.pyplot as plt3import os4class SymbolDataset(Dataset):5 def __init__(self, root_path, transform, resolution):6 super().__init__()7 resolution_path = os.path.join(root_path, str(resolution))8 train_image = []9 for image_file in os.listdir(resolution_path):10 image_path = os.path.join(resolution_path, image_file)11 ext = os.path.splitext(image_path)[-1]12 if ext not in ['.png', '.jpg']:13 continue14 image = plt.imread(image_path)15 if ext == '.png':16 image = image * 25517 image = image.astype('uint8')18 train_image.append(image)19 self.train_image = train_image20 self.transform = transform21 self.resolution = resolution22 def __len__(self):23 return len(self.train_image)24 def __getitem__(self, index):25 X = self.train_image[index]...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!