Skip to main content

Library for creating data input pipeline in pure Tensorflow 2.x

Project description

Chitra

Library for creating data input pipeline in Tensorflow

Install

pip install chitra

How to use

Loading data for image classification

import numpy as np
import tensorflow as tf
import chitra
from chitra.dataloader import Clf, show_batch
import matplotlib.pyplot as plt
path = '/Users/aniket/Pictures/data/train'

clf_dl = Clf()
data = clf_dl.from_folder(path, target_shape=(224, 224))

clf_dl.show_batch(8, figsize=(8,8))
CLASSES ENCODED: {'cat': 0, 'dog': 1}

png

for e in data.take(1):
    image = e[0].numpy().astype('uint8')
    label = e[1].numpy()
plt.imshow(image)
<matplotlib.image.AxesImage at 0x7fee1000df10>

png

from chitra.visualization import draw_annotations
labels = np.array([label])
bbox = np.array([[30, 50, 170, 190]])
label_to_name = lambda x: 'Cat' if x==0 else 'Dog'
draw_annotations(image, ({'bboxes': bbox, 'labels':labels,}), label_to_name=label_to_name)
plt.imshow(image)
<matplotlib.image.AxesImage at 0x7fee0fe37890>

png

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chitra-0.0.11.tar.gz (12.4 kB view hashes)

Uploaded Source

Built Distribution

chitra-0.0.11-py3-none-any.whl (13.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page