Skip to main content

Threaded File Loader

Github: ThreadedFileLoader

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
print(len(images))
print(images[0].shape)

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_)

Metadata

Release files for ThreadedFileLoader 1.0.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ThreadedFileLoader 1.0.0.11
File Size Uploaded
ThreadedFileLoader-1.0.0.11.tar.gz 2.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ThreadedFileLoader 1.0.0.11
File Interpreter ABI Platform
ThreadedFileLoader-1.0.0.11-py3-none-any.whl Python 3 none any Details

Total release size: 5.6 kB

Release files / ThreadedFileLoader-1.0.0.11.tar.gz

Download URL ThreadedFileLoader-1.0.0.11.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b8b7177931976a583bd3fb938f5e5273f18444fe69a7a77ead2ce7760bcbecdd
BLAKE2b-256 checksum
How to use checksums
b9b1a19b0450aa8724f10cd3fd462f407122927ccdeced3e9aadd6c37b2a32b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.0 requests/2.22.0 setuptools/50.3.0.post20201006 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.7

Release files / ThreadedFileLoader-1.0.0.11-py3-none-any.whl

Download URL ThreadedFileLoader-1.0.0.11-py3-none-any.whl
Size 3.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cedf88ce64668607d21c85b4a363847682352cec6660b790e79ddb7df84d56a9
BLAKE2b-256 checksum
How to use checksums
d0f8db83cadba00cde141d32a37aa975fb9ff5b0178543351e5a661f688ea349
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.0 requests/2.22.0 setuptools/50.3.0.post20201006 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.7
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page