Skip to content

Instantly share code, notes, and snippets.

@andrewjong
andrewjong / pytorch_image_folder_with_file_paths.py
Last active October 31, 2024 11:13
PyTorch Image File Paths With Dataset Dataloader
import torch
from torchvision import datasets
class ImageFolderWithPaths(datasets.ImageFolder):
"""Custom dataset that includes image file paths. Extends
torchvision.datasets.ImageFolder
"""
# override the __getitem__ method. this is the method that dataloader calls
def __getitem__(self, index):
@Aniruddha-Tapas
Aniruddha-Tapas / directkeys.py
Created April 26, 2017 15:09
Script to emulate key-presses on Windows via Python.
# directkeys.py
# http://stackoverflow.com/questions/13564851/generate-keyboard-events
# msdn.microsoft.com/en-us/library/dd375731
import ctypes
from ctypes import wintypes
import time
user32 = ctypes.WinDLL('user32', use_last_error=True)