Skip to main content

Computer vision research lib.

Project description

Nahre

Vanilla computer vision research and prototype package. Lets you dive straight into problem solving mindset. You don't have to worry about tedious stuff.

  • loading data
  • batch configuration
  • record processing

Getting started

pip install nahre

How to use

Data

Put your image files in a single folder. Both flat and nested structures are supported.

Processor

Processor class must implement base Processor interface, which ships with this package. When batch is executed, every record from data set is ran against process method. This method must return results which matches next processor's interface on the list.

Example

from pathlib import Path

import numpy as np
from austen import Logger
from degas import FluentImage
from lazy import lazy
from pytest import fixture
from skimage import color, exposure, feature

from nahre import Batch, Processor, execute
from nahre.io import Data


class EdgeProcessor(Processor):

    def __init__(self, logger: Logger):
        super().__init__(logger)

    @lazy
    def _description(self):
        return 'Any description is better than none.'

    def process(self, src: np.ndarray):

        with FluentImage(src, self.logger, 'preprocessing') as preprocessed:

            preprocessed >> (
                color.rgb2gray
            ) >> (
                exposure.rescale_intensity
            ) >> (
                exposure.equalize_adapthist
            ) >> (
                feature.canny
            )

            return {
                'preprocessed': preprocessed.image
            }


batch = Batch(
    data=Data(Path('data')),
    processors=[EdgeProcessor],
    log_root=Path('log')
)

execute([batch])

nahre will dump any intermediate images using austen package. Additionally, final results will be dumped in separate folder.

Tests

cd [project-path]
python -m pytest

Project details


Release history Release notifications

This version

0.1.1

Download files

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

Files for nahre, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size nahre-0.1.1-py3-none-any.whl (8.9 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size nahre-0.1.1.tar.gz (5.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page