Esempio n. 1
0
    def test_main_process(self):
        """ Main process of unit test. """

        # test case with plotting arrow
        dyda_config_LocationBubblePlotter = {
            'LocationBubblePlotter': {
                "belongs_to": "virtual_id",
                "plot_arrow": True
            }
        }

        output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/'\
                     'uploads/ee7e62a737ab364cf96bc29dfaf55425/bp_arrow.bmp'

        # initialization
        comp = LocationBubblePlotter(
            dyda_config_path=dyda_config_LocationBubblePlotter)
        comp.reset()
        comp.input_data = test_df
        comp.run()

        # compare output_data with reference
        ref_data = lab_tools.pull_img_from_gitlab(output_url)
        tar_data = comp.output_data
        img_diff = lab_tools.img_comparator(ref_data, tar_data)
        self.assertEqual(img_diff, 0.0)

        # test case without plotting arrow
        dyda_config_LocationBubblePlotter = {
            'LocationBubblePlotter': {
                "belongs_to": "virtual_id",
                "plot_arrow": False
            }
        }

        output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/'\
                     'uploads/4b592ecb09944b7d9412db84a233f166/bp.bmp'

        # initialization
        comp = LocationBubblePlotter(
            dyda_config_path=dyda_config_LocationBubblePlotter)
        comp.reset()
        comp.input_data = test_df
        comp.run()

        # compare output_data with reference
        ref_data = lab_tools.pull_img_from_gitlab(output_url)
        tar_data = comp.output_data
        img_diff = lab_tools.img_comparator(ref_data, tar_data)
        self.assertEqual(img_diff, 0.0)
Esempio n. 2
0
    def test_main_process(self):
        """ Main process of unit test. """

        dyda_config_DataFrameHistPlotter = {
            'DataFrameHistPlotter': {
                'hist_feature': ['longitude', 'latitude']
            }
        }
        output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/'\
                     'uploads/23e072aff6360991f5c004b475aaf7f2/hist.bmp'
        # initialization
        comp = DataFrameHistPlotter(
            dyda_config_path=dyda_config_DataFrameHistPlotter)

        # run component
        comp.reset()
        comp.input_data = test_df
        comp.run()
        # compare output_data with reference
        ref_data = lab_tools.pull_img_from_gitlab(output_url)
        tar_data = comp.output_data
        img_diff = lab_tools.img_comparator(ref_data, tar_data)
        self.assertEqual(img_diff, 0.0)

        # test the case with using all parameters
        dyda_config_DataFrameHistPlotter = {
            'DataFrameHistPlotter': {
                'hist_feature': ['longitude', 'latitude'],
                'range': [(-122.5, -121.5), (47.5, 47.7)],
                'bins': 20,
                'belongs_to': 'virtual_id'
            }
        }
        output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
                     'c7667cbeae10c6cc41defcae2c6bafe1/hist_complicated.bmp'
        # initialization
        comp = DataFrameHistPlotter(
            dyda_config_path=dyda_config_DataFrameHistPlotter)

        # run component
        comp.reset()
        comp.input_data = test_df
        comp.run()
        # compare output_data with reference
        ref_data = lab_tools.pull_img_from_gitlab(output_url)
        tar_data = comp.output_data
        img_diff = lab_tools.img_comparator(ref_data, tar_data)
        self.assertEqual(img_diff, 0.0)
Esempio n. 3
0
    def test_main_process(self):

        # pull test data from gitlab
        config_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/"
                      "uploads/6bd42ac664cecf4fdc29a4ed894874d2/"
                      "dyda.config.ClassifierAoiCornerAvg")
        dyda_config = lab_tools.pull_json_from_gitlab(config_url)

        img_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/"
                   "697de0fe3c7d5a530674ddd996a0129a/NG_TYPE2_0063.png")
        ref_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/"
                   "1cd293379a63b3a843bfe47e754e495f/"
                   "test_ClassifierAoiCornerAvg.json")
        img = lab_tools.pull_img_from_gitlab(img_url)
        ref_data = lab_tools.pull_json_from_gitlab(ref_url)[2]["results"][0]

        classifier = ClassifierAoiCornerAvg(dyda_config_path=dyda_config)
        classifier.input_data = [img]
        classifier.run()

        tar_data = classifier.results[0]
        report = dict_comparator.get_diff(ref_data, tar_data)
        self.assertEqual(report['extra_field'], [])
        self.assertEqual(report['missing_field'], [])
        self.assertEqual(report['mismatch_val'], [])
Esempio n. 4
0
    def test_main_process(self):

        # pull test data from gitlab
        config_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/"
                      "abf5cf6f40a4b31216b0dabbe81a6863/"
                      "dyda.config.mobilenet_unittest")
        dyda_config = lab_tools.pull_json_from_gitlab(config_url)

        img_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/"
                   "4fa6b8a454f9b4041bdde316bac85a27/IMAG1450.jpg")
        ref_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/"
                   "8ea9ac61e3403981eca23c658b2cdac7/"
                   "ref_results.json.mobilenet")
        img = lab_tools.pull_img_from_gitlab(img_url)
        ref_data = lab_tools.pull_json_from_gitlab(ref_url)

        classifier = ClassifierMobileNet(dyda_config_path=dyda_config)
        classifier.input_data = [img]
        classifier.run()

        tar_data = classifier.results[0]
        report = dict_comparator.get_diff(ref_data, tar_data)
        self.assertEqual(report['extra_field'], [])
        self.assertEqual(report['missing_field'], [])
        self.assertEqual(report['mismatch_val'], [])
Esempio n. 5
0
    def test_main_process(self):

        # pull test data from gitlab
        config_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads"
                      "/b6fec0ae2bc4c0913e3e765c2a87b135/"
                      "dyda.config.inceptionv3_unittest")
        dyda_config = lab_tools.pull_json_from_gitlab(config_url)

        img_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/"
                   "4fa6b8a454f9b4041bdde316bac85a27/IMAG1450.jpg")
        ref_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/"
                   "1ca61414f75fa6b93e09944a3bf1b66b/"
                   "ref_json.json.inceptionv3_unittest")
        img = lab_tools.pull_img_from_gitlab(img_url)
        ref_data = lab_tools.pull_json_from_gitlab(ref_url)

        classifier = ClassifierInceptionv3(dyda_config_path=dyda_config)
        classifier.input_data = [img]
        classifier.run()

        tar_data = classifier.results[0]
        report = dict_comparator.get_diff(ref_data, tar_data)
        self.assertEqual(report['extra_field'], [])
        self.assertEqual(report['missing_field'], [])
        self.assertEqual(report['mismatch_val'], [])
Esempio n. 6
0
    def test_main_process(self):
        # pull test data from gitlab
        img_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
                  'd2ebc6170f05578273b934cfb6ed7344/pict000301.jpg'

        json_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
                   'c8457db3f0d2b1ddb1fd7f6730168b9c/metadata_pic301.json'

        result_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
                     '952964ae5dbdb06eec74d716d7636576/pict000301_result.json'

        img = lab_tools.pull_img_from_gitlab(img_url)
        meta_data = lab_tools.pull_json_from_gitlab(json_url)
        ref_data = lab_tools.pull_json_from_gitlab(result_url)

        # initialization
        data = [img, meta_data]
        data_preprocessor_ = preprocessor.LabelMeDataPreProcessor()
        data_preprocessor_.meta_data = meta_data

        data_preprocessor_.input_data = data
        data_preprocessor_.run()

        tar_data = data_preprocessor_.results
        ref_data['data_path'] = []
        report = dict_comparator.get_diff(ref_data, tar_data)

        self.assertEqual(report['extra_field'], [])
        self.assertEqual(report['missing_field'], [])
        self.assertEqual(report['mismatch_val'], [])
Esempio n. 7
0
    def test_main_process(self):

        # pull test data from gitlab
        config_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads"
                      "/418f17cdcdb4c9ee7555ef467e042a8c/dyda.config")
        dyda_config = lab_tools.pull_json_from_gitlab(config_url)

        cwd = os.getcwd()
        filename = ".testing_img.jpg"
        local_path = os.path.join(cwd, filename)

        img_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/"
                   "4fa6b8a454f9b4041bdde316bac85a27/IMAG1450.jpg")
        img = lab_tools.pull_img_from_gitlab(img_url, save_to=local_path)

        ref_url = ("https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/"
                   "4d57dd72be420cda1acea39f7665d76c/"
                   "ref_data.json.framereader_unittest")
        ref_data = lab_tools.pull_json_from_gitlab(ref_url)

        reader = FrameReader(dyda_config_path=dyda_config)
        reader.input_data = [local_path]
        reader.run()

        tar_data = reader.results

        report = dict_comparator.get_diff(ref_data, tar_data)
        self.assertEqual(report['extra_field'], [])
        self.assertEqual(report['missing_field'], [])

        # Since the filepath depending on cwd, the folder wont match anyway
        for mis_match in report['mismatch_val']:
            for tar_key in mis_match['tar_key']:
                if isinstance(tar_key, list) and tar_key[0] == 'data_path':
                    _tar_val = os.path.basename(mis_match['tar_val'])
                    _ref_val = os.path.basename(mis_match['ref_val'])
                    self.assertEqual(_tar_val, _ref_val)
                else:
                    self.assertEqual(report['mismatch_val'], [])
        os.remove(local_path)
Esempio n. 8
0
    def test_main_process(self):

        # pull test data from gitlab
        input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
            'b7abe78697075dc2e47de5327c9f2de3/cv_classifier_input_list.json'
        input_list = lab_tools.pull_json_from_gitlab(input_url)
        output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
            '01fd55515c6373ced2541f0aec287f44/ref_bkg.jpg'
        ref_output = lab_tools.pull_img_from_gitlab(output_url)

        # initialization
        learner_ = LearnerSimpleCV()

        image_list = []
        for i in range(len(input_list)):
            image_list.append(image.read_img(input_list[i]))

        # run classifier
        learner_.reset()
        learner_.input_data = image_list
        learner_.run()
        diff = tinycv.l1_norm_diff_cv2(learner_.output_data, ref_output)
        self.assertEqual(sum(sum(diff)), 0.0)
Esempio n. 9
0
    def test_main_process(self):

        # test the case with using HOG
        dyda_config = {"FaceDetector": {"model": "hog"}}

        ref_data = {'filename': '', 'size': {'width': 960, 'height': 544},
                    'annotations': [{'left': 414, 'right': 637, 'top': 192,
                                     'labinfo': {}, 'bottom': 415,
                                     'type': 'detection', 'id': 0,
                                     'label': 'face', 'confidence': -1.0}],
                    'folder': ''}

        face_detector = FaceDetector(dyda_config_path=dyda_config)

        input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
                    'a73f92e9b271420d48f70481f56944c4/2019-03-15-111527.jpg'

        input_data = lab_tools.pull_img_from_gitlab(input_url)
        face_detector.input_data = input_data.copy()
        face_detector.run()

        tar_data = face_detector.results

        report = dict_comparator.get_diff(ref_data, tar_data)
        self.assertEqual(report['extra_field'], [])
        self.assertEqual(report['missing_field'], [])

        # Since the filename depending on time stamp, it wont match anyway
        for mis_match in report['mismatch_val']:
            for tar_key in mis_match['tar_key']:
                if tar_key == 'filename':
                    continue
                else:
                    self.assertEqual(report['mismatch_val'], [])

        # test the case with list input
        dyda_config = {"FaceDetector": {"model": "hog"}}

        face_detector = FaceDetector(dyda_config_path=dyda_config)

        input_data = lab_tools.pull_img_from_gitlab(input_url)
        face_detector.input_data = [input_data.copy()]
        face_detector.run()

        tar_data = face_detector.results

        report = dict_comparator.get_diff([ref_data], tar_data)
        self.assertEqual(report['extra_field'], [])
        self.assertEqual(report['missing_field'], [])

        # Since the filename depending on time stamp, it wont match anyway
        for mis_match in report['mismatch_val']:
            for tar_key in mis_match['tar_key']:
                if tar_key == 'filename':
                    continue
                else:
                    self.assertEqual(report['mismatch_val'], [])

        # test the case with using CNN
        dyda_config = {"FaceDetector": {"model": "cnn"}}

        ref_data = {'annotations': [{'top': 200, 'confidence': -1.0,
                                     'labinfo': {}, 'type': 'detection',
                                     'right': 627, 'bottom': 404,
                                     'label': 'face', 'left': 424, 'id': 0}],
                    'filename': '', 'folder': '',
                    'size': {'width': 960, 'height': 544}}

        face_detector = FaceDetector(dyda_config_path=dyda_config)

        face_detector.input_data = input_data.copy()
        face_detector.run()

        tar_data = face_detector.results

        report = dict_comparator.get_diff(ref_data, tar_data)
        self.assertEqual(report['extra_field'], [])
        self.assertEqual(report['missing_field'], [])

        # Since the filename depending on time stamp, it wont match anyway
        for mis_match in report['mismatch_val']:
            for tar_key in mis_match['tar_key']:
                if tar_key == 'filename':
                    continue
                else:
                    self.assertEqual(report['mismatch_val'], [])

        # test the case with specify upsample_times
        dyda_config = {"FaceDetector": {"model": "cnn",
                                           "upsample_times": 3}}

        ref_data = {'folder': '', 'filename': '',
                    'annotations': [{'right': 613, 'top': 165, 'left': 394,
                                     'label': 'face', 'bottom': 384,
                                     'id': 0, 'confidence': -1.0,
                                     'labinfo': {}, 'type': 'detection'}],
                    'size': {'width': 960, 'height': 544}}

        face_detector = FaceDetector(dyda_config_path=dyda_config)

        face_detector.input_data = input_data.copy()
        face_detector.run()
        tar_data = face_detector.results

        report = dict_comparator.get_diff(ref_data, tar_data)
        self.assertEqual(report['extra_field'], [])
        self.assertEqual(report['missing_field'], [])

        # Since the filename depending on time stamp, it wont match anyway
        for mis_match in report['mismatch_val']:
            for tar_key in mis_match['tar_key']:
                if tar_key == 'filename':
                    continue
                else:
                    self.assertEqual(report['mismatch_val'], [])
Esempio n. 10
0
import cv2
import unittest
from dyda_utils import tools
from dyda_utils import tinycv
from dyda_utils import lab_tools
from dyda_utils import dict_comparator
from dyda.components.image_processor import BGR2GrayImageProcessor

# pull test data from gitlab
print('[Test_BGR2GrayImageProcessor] INFO: Pull 9 KB files from gitlab. ')
input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '05e15e0a9133b30f5bfbe6c02d6847a4/input_img.png.0'
input_data = lab_tools.pull_img_from_gitlab(input_url)
config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '886e16adbfb8d630ead9ab74e88d113c/BGR2GrayImageProcessor.config'
dyda_config_BGR2GrayImageProcessor = lab_tools.pull_json_from_gitlab(
    config_url)
output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    'baf7b36e1aff5a1abfb623af7fbf09a7/TestBGR2GrayImageProcessor_simple.bmp.0'
output_BGR2GrayImageProcessor = lab_tools.pull_img_from_gitlab(output_url)


class TestBGR2GrayImageProcessor_simple(unittest.TestCase):
    """ Test simple case. """
    def test_main_process(self):
        """ Main process of unit test. """

        # initialization
        comp = BGR2GrayImageProcessor(
            dyda_config_path=dyda_config_BGR2GrayImageProcessor)
Esempio n. 11
0
import cv2
import unittest
from dyda_utils import tools
from dyda_utils import tinycv
from dyda_utils import lab_tools
from dyda_utils import dict_comparator
from dyda.components.image_processor import ResizeImageProcessor

# pull test data from gitlab
print('[Test_ResizeImageProcessor] INFO: Pull 18 KB files from gitlab. ')
input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '05e15e0a9133b30f5bfbe6c02d6847a4/input_img.png.0'
input_data = lab_tools.pull_img_from_gitlab(input_url)
config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '89e5f0abb7fc8a8f1591a45a105e6fca/dyda.config.ResizeImageProcessor'
dyda_config_ResizeImageProcessor = lab_tools.pull_json_from_gitlab(config_url)
output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '42a4b5bc1dc5f0ec8aad0ac58abdb699/TestResizeImageProcessor_simple.bmp.0'
output_ResizeImageProcessor = lab_tools.pull_img_from_gitlab(output_url)
results_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    'd291d335efe85ca594207fb4ff301a7b/TestResizeImageProcessor_simple.json'
results_ResizeImageProcessor = lab_tools.pull_json_from_gitlab(results_url)
output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '42a4b5bc1dc5f0ec8aad0ac58abdb699/TestResizeImageProcessor_simple.bmp.0'
output_ResizeImageProcessor = lab_tools.pull_img_from_gitlab(output_url)


class TestResizeImageProcessor_simple(unittest.TestCase):
    """ Test simple case. """
    def test_main_process(self):
        """ Main process of unit test. """
import cv2
import unittest
from dyda_utils import tools
from dyda_utils import tinycv
from dyda_utils import lab_tools
from dyda_utils import dict_comparator
from dyda.components.image_processor import CropRoiImageProcessor

# pull test data from gitlab
print('[Test_CropRoiImageProcessor] INFO: Pull 34 KB files from gitlab. ')
input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '05e15e0a9133b30f5bfbe6c02d6847a4/input_img.png.0'
input_data = lab_tools.pull_img_from_gitlab(input_url)
input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '63ee0fac22eb43882dcefa3ec154df54/frame_781.jpg.0'
input_data_calibrate = lab_tools.pull_img_from_gitlab(input_url)
config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '78a5e35b2802ddbee8614aefbceb2fdb/dyda.config.CropRoiImageProcessor'
dyda_config_CropRoiImageProcessor = lab_tools.pull_json_from_gitlab(config_url)
metadata_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    'ddc0b4970202e99c3a1248c5af66480e/TestResizeImageProcessor_metadata.json'
metadata_CropRoiImageProcessor = lab_tools.pull_json_from_gitlab(metadata_url)
output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    'c8c952e97929e1e3f47c15740f2b7dc4/TestCropRoiImageProcessor_simple.bmp.0'
output_CropRoiImageProcessor = lab_tools.pull_img_from_gitlab(output_url)
results_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '473726f1c287475360e7a177dbb2b4aa/TestCropRoiImageProcessor_simple.json'
results_CropRoiImageProcessor = lab_tools.pull_json_from_gitlab(results_url)
output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    'a9bf448d4c9831559053bde0dea0c595/TestCropRoiImageProcessor_metadata.bmp.0'
output_CropRoiImageProcessor_m = lab_tools.pull_img_from_gitlab(output_url)
from dyda_utils import tools
from dyda_utils import tinycv
from dyda_utils import lab_tools
from dyda_utils import dict_comparator
from dyda.components.image_processor import CalibrateImageProcessor


# pull test data from gitlab
print('[Test_CalibrateImageProcessor] INFO: Pull 189 KB files from gitlab. ')
config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '6ad6cb384843092a563a6f3b20a86672/dyda.config.CalibrateImageProcessor'
dyda_config_CalibrateImageProcessor = lab_tools.pull_json_from_gitlab(
    config_url)
input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '63ee0fac22eb43882dcefa3ec154df54/frame_781.jpg.0'
input_data_calibrate = lab_tools.pull_img_from_gitlab(input_url)
output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    'f3dc2a06bef9759fb92549f1d0491a5e/TestCalibrateImageProcessor_simple.bmp.0'
output_CalibrateImageProcessor = lab_tools.pull_img_from_gitlab(output_url)


class TestCalibrateImageProcessor_simple(unittest.TestCase):
    """ Test simple case. """

    def test_main_process(self):
        """ Main process of unit test. """

        # initialization
        comp = CalibrateImageProcessor(
            dyda_config_path=dyda_config_CalibrateImageProcessor)
import cv2
import unittest
from dyda_utils import tools
from dyda_utils import tinycv
from dyda_utils import lab_tools
from dyda_utils import dict_comparator
from dyda.components.image_processor import MergeImageProcessor

# pull test data from gitlab
print('[Test_MergeImageProcessor] INFO: Pull 44 KB files from gitlab. ')
input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '93cae1cc3aa4d6e1dcf9b9c052b1bc3b/00000001.png.0'
input_data_0 = lab_tools.pull_img_from_gitlab(input_url)
input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '1bcd5ac6691702dbbe445e2712f0f59f/00000370.png.0'
input_data_1 = lab_tools.pull_img_from_gitlab(input_url)
input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '4d471f2dd9750d9ebedfb90f0a8d7d3e/00000290.png.0'
input_data_2 = lab_tools.pull_img_from_gitlab(input_url)
input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '10a38fd6449a7838689a30f2fcea0d88/00000030.png.0'
input_data_3 = lab_tools.pull_img_from_gitlab(input_url)
config_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '7b0fb06a326646bd696fee48722b3f12/MergeImageProcessor.config'
dyda_config_MergeImageProcessor = lab_tools.pull_json_from_gitlab(config_url)
output_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
    '11c4450c29fbc111daa115e55c48100f/TestMergeImageProcessor_simple.bmp.0'
output_MergeImageProcessor = lab_tools.pull_img_from_gitlab(output_url)


class TestMergeImageProcessor_simple(unittest.TestCase):
Esempio n. 15
0
import cv2
import unittest
import numpy as np
from dyda_utils import tools
from dyda_utils import tinycv
from dyda_utils import lab_tools
from dyda_utils import dict_comparator
from dyda.components.image_processor import BGR2RGBImageProcessor
from dyda.components.face_recognizer import FaceEncodingImageProcessor

# pull test data from gitlab
input_url = 'https://gitlab.com/DT42/galaxy42/dt42-dyda/uploads/'\
            'a73f92e9b271420d48f70481f56944c4/2019-03-15-111527.jpg'
input_data = lab_tools.pull_img_from_gitlab(input_url)


class TestBGR2RGBImageProcessor(unittest.TestCase):
    def test_main_process(self):
        """ Main process of unit test. """

        # Test simple case
        dyda_config = {"BGR2RGBImageProcessor": {}}

        # initialization
        comp = BGR2RGBImageProcessor(dyda_config_path=dyda_config)

        # run component
        comp.reset()
        comp.input_data = input_data.copy()
        comp.run()