No project description provided
Project description
Threaded File Loader
Multithreaded Python package for faster file loading in machine learning.
Installation
pip install ThreadedFileLoader
Usage:
Loading Image Files:
from ThreadedFileLoader.ThreadedFileLoader import *
instance = ThreadedImageLoader("path_to_/*.jpg")
instance.start_loading()
images = instance.loaded_objects
Loading Text Files:
from ThreadedFileLoader.ThreadedFileLoader import *
instance = ThreadedTextLoader("path_to_/*.txt")
instance.start_loading()
images = instance.loaded_objects
Loading Custom File Formats
Threaded FileLoader can load different file types.
This examples shows how the ThreadedTextLoader
class
overloads the ThreadedFileLoader
class to load text files.
from ThreadedFileLoader.ThreadedFileLoader import *
class ThreadedTextLoader(ThreadedFileLoader):
def object_loader(self, path):
with open(path) as afile:
data = afile.readlines()
return data
instance = ThreadedTextLoader("path_to_/*.txt")
instance.start_loading()
texts = instance.loaded_objects
Machine Learning Example
Loading Dataset
import numpy as np
from ThreadedFileLoader.ThreadedFileLoader import *
from sklearn.cluster import KMeans
instance = ThreadedImageLoader("path_to_dataset/*.jpg")
instance.start_loading()
images = instance.loaded_objects
images = np.array(images)
images = images.reshape(len(images), -1)
kmeans = KMeans(n_clusters=10, random_state=0).fit(images)
print(kmeans.labels_)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for ThreadedFileLoader-1.0.0.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb350cf122996b68b93d824411217f68aaf3bd0bac403443d7bc76f689503ee5 |
|
MD5 | f0c65779bca2da299b6314944eeb69cf |
|
BLAKE2b-256 | 71e87bd305c6a649d451460aedc89b23be220ad6ff4b4be3ab0d9916ade63f7d |
Close
Hashes for ThreadedFileLoader-1.0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e224a1799632fa5ae1481ee4cd5861a661ffc6537e84723e42fd66e6ab24710c |
|
MD5 | ec3525f3d4554ae861ebb679fadf184c |
|
BLAKE2b-256 | c5033ee3b03d6216751fb1555e8b0b07333c943fe9a0065a7b409648c1ea6da2 |