Library for creating data input pipeline in pure Tensorflow 2.x
Project description
Chitra
Library for creating data input pipeline in pure Tensorflow 2.x
.
Install
pip install chitra
How to use
Loading data for image classification
import tensorflow as tf
import chitra
from chitra.dataloader import Clf, show_batch
path = '/Users/aniketmaurya/Pictures/cats'
clf_dl = Clf()
data = clf_dl.from_folder(path)
print('class names:', clf_dl.CLASS_NAMES)
show_batch(data, 6, (6, 6))
class names: ('Whitecat', 'Blackcat')
model = tf.keras.applications.ResNet50(include_top=False,
weights='imagenet',
input_shape=(160, 160, 3),
classes=2)
model.fit(data)
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-7-bcfd88bde046> in <module>
----> 1 model.fit(data)
~/miniconda3/envs/tf/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs)
703 if kwargs:
704 raise TypeError('Unrecognized keyword arguments: ' + str(kwargs))
--> 705 self._assert_compile_was_called()
706 self._check_call_args('fit')
707
~/miniconda3/envs/tf/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py in _assert_compile_was_called(self)
2872 # (i.e. whether the model is built and its inputs/outputs are set).
2873 if not self.optimizer:
-> 2874 raise RuntimeError('You must compile your model before '
2875 'training/testing. '
2876 'Use `model.compile(optimizer, loss)`.')
RuntimeError: You must compile your model before training/testing. Use `model.compile(optimizer, loss)`.
# for e in data.batch(4): print(e)
img = chitra.image.read_image('/Users/aniketmaurya/Pictures/cats/whitecat/wcat1.jpg')
img.shape
TensorShape([683, 1024, 3])
chitra.image.resize_image(img, (160, 160)).shape
TensorShape([160, 160, 3])
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
chitra-0.0.4.tar.gz
(10.5 kB
view details)
Built Distribution
chitra-0.0.4-py3-none-any.whl
(10.3 kB
view details)
File details
Details for the file chitra-0.0.4.tar.gz
.
File metadata
- Download URL: chitra-0.0.4.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d89aa47e27631f384171ed3eb45b023ca6d04650e59a80b7c29806c0904913c4 |
|
MD5 | 3e51103d75ca1829c5d32b4a60988e0f |
|
BLAKE2b-256 | 09801682ed379e4366b1a57d11aa3cc1c7e4969b1e10abc6e9246b1c38b12485 |
Provenance
File details
Details for the file chitra-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: chitra-0.0.4-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4e661d18a484700a7319562617eb59059e5349ec570d46964c355c4faba6978 |
|
MD5 | ee23fdd6e6d3731d470f322a0c5edece |
|
BLAKE2b-256 | dcbdd3bf3bf40f9caa8bb74f9a85bca3ca99977e7827a842a42026c2f749014c |