Skip to main content

Images made easy

Project description


# easyimages

[![Foo](https://img.shields.io/pypi/v/easyimages.svg)](https://pypi.python.org/pypi/easyimages)
[![Foo](https://img.shields.io/travis/i008/easyimages.svg)](https://travis-ci.org/i008/easyimages)
[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)


# Info

This small but handy package solves several issues i had while working with images and image datasets - especially in the context
of exploring datsets, inspecting and shareing the results.
Keep in mind that his package is not directly related to the training process and loading
image data, for that i found pytorch dataloading patterns to work very well.

# Installation
```bash
pip install easyimages
```


Features
--------
- Simple API
- Easy image exploration
- Inteligent behaviour based on execution context (terminal, jupyter etc)
- Lazy evaluation
- Loading images from many different sources (filesystem, pytorch, numpy, web-urls, etc)
- Storing annotations (tags, bounding boxes) allong the image in the same object
- Visualizing labels (drawing boxes and drawing the label onto the image)
- Visualizing images as Grids (ImagesLists)
- Visualizing huge amounts of images at once (by leveraging fast html rendering)
- Displaying images while working in jupyter notebook
- Displaying images inline in console mode (iterm)



Examples
--------

For detailed examples check the examples notebook





```python
from easyimages import EasyImage, EasyImageList, bbox
import torch
import torchvision
from torchvision import transforms
import PIL
```

# EasyImage


#### image from file


```python
# in this context lazy means the object will store the metadata only and will not open the file just yet
image1 = EasyImage.from_file('./tests/test_data/image_folder/img_00000002.jpg',label=['Person'], lazy=True)
image1.show()
```

EasyImageObject: img_00000002.jpg | labels: ['Person'] | downloaded: True | size: (205, 300) |





![png](example/output_2_1.png)



#### image from file in CLI (iterm only) :

![png](example/easy_cli.png)

#### image from url



```python
image2 = EasyImage.from_url('https://imgur.com/KDBRjyv.png')
image2.show()
```

EasyImageObject: KDBRjyv.png | labels: [] | downloaded: True | size: (237, 212) |





![png](example/output_4_1.png)



#### image from torch-like


```python
MEAN = [0.485, 0.456, 0.406]
STD = [0.229, 0.224, 0.225]

Trans = torchvision.transforms.Compose([
transforms.ToTensor(),
transforms.Normalize(mean=MEAN, std=STD),
])
torch_image = Trans(PIL.Image.open('./tests/test_data/image_folder/img_00000003.jpg'))


image3 = EasyImage.from_torch(torch_image, mean=MEAN, std=STD)
image3.show()
```

EasyImageObject: ef807dcc.jpg | labels: [] | downloaded: True | size: (170, 250) |


![png](example/output_6_1.png)



#### Draw label on image


```python
image2.boxes = [bbox(10, 10, 50, 50, 1, 'class_1'),
bbox(50, 50, 100, 100, 1, 'class_2')]
image2.draw_boxes().show()
```

EasyImageObject: KDBRjyv.png | labels: [] | downloaded: True | size: (324, 291) |



![png](example/output_8_1.png)
----

#### Initialize EasyImageList in a number of ways:


```python
easy_list = EasyImageList.from_multilevel_folder('./tests/test_data/hierarchy_images/')

<ImageList with 6 EasyImages>
```

```python
easy_list = EasyImageList.from_glob('tests/test_data/image_folder/*.jpg')

<ImageList with 3 EasyImages>
```

```python
easy_list = EasyImageList.from_pil('tests/test_data/image_folder/*.jpg')

<ImageList with 3 EasyImages>
```

```python
# sometimes its handy to have a numpy array like image
r = easy_list.visualize_grid_numpy(montage_shape=(3,2))
```

![png](example/output_12_0.png)


#### visualize a big dataset

![png](example/vis.png)


#### You can switch between classes you visualize with a notebook widget

![png](example/widget.png)


=======
History
=======

0.1.0 (2018-08-24)
------------------

* First release on PyPI.


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

easyimages-0.7.8.tar.gz (174.1 kB view details)

Uploaded Source

Built Distribution

easyimages-0.7.8-py2.py3-none-any.whl (88.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file easyimages-0.7.8.tar.gz.

File metadata

  • Download URL: easyimages-0.7.8.tar.gz
  • Upload date:
  • Size: 174.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.10.0 pkginfo/1.4.1 requests/2.11.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.4

File hashes

Hashes for easyimages-0.7.8.tar.gz
Algorithm Hash digest
SHA256 11f446fc41a3757293e77e5f82e56479d3783495ab4a5fffb774a8f0353c96b6
MD5 10a2c5e4933c92b884771d90b977b7ef
BLAKE2b-256 226fa7d0a7c4031f630d566210a8117e89fde396cb20ed3f825e7bab8987ce6b

See more details on using hashes here.

File details

Details for the file easyimages-0.7.8-py2.py3-none-any.whl.

File metadata

  • Download URL: easyimages-0.7.8-py2.py3-none-any.whl
  • Upload date:
  • Size: 88.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.10.0 pkginfo/1.4.1 requests/2.11.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.4

File hashes

Hashes for easyimages-0.7.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 845f3b5edba6d5dc20be830dd5585c84557386ce74831011dab9a85e851f945a
MD5 9b46514612966bb48dccfb772c4acd98
BLAKE2b-256 5eb9a9c6aa8a5ec6c7f9ecdd9e6b7f8bae596dbe1052405ceddf0a9b282cd64a

See more details on using hashes here.

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