Exemplo n.º 1
0
 def on_get(self, req, resp):
     try:
         PF = PathFinder()
         content = PF.__dict__
         success, message = True, ""
     except Exception as e:
         content, success, message = {}, False, str(e)
     data = {'data': content, 'success': success, 'message': message}
     resp.body = json.dumps(data)
Exemplo n.º 2
0
 def on_post(self, req, resp):
     self.PF = PathFinder()
     self.sm = StatMaster()
     # try:
     request = decode(req)
     content = request.get('labels', [])
     success, message = self.sm.delete_label(content)
     # except Exception as e:
     # content, success, message = {}, False, str(e)
     resp.body = json.dumps({'success': success, 'message': message})
Exemplo n.º 3
0
    def on_post(self, req, resp):
        self.PF = PathFinder()
        self.sm = StatMaster()
        request = decode(req)
        class_name = request.get('class_name', [])
        try:
            content, success, message = self.sm.get_image_path_by_label(
                class_name)
        except Exception as e:
            content, success, message = [], False, str(e)

        data = {'data': content, 'success': success, 'message': message}
        resp.body = json.dumps(data)
Exemplo n.º 4
0
 def on_post(self, req, resp):
     try:
         PF = PathFinder()
         request = decode(req)
         for k, v in request.items():
             PF.__setattr__(k, v)
         PF.save()
         success, message = True, ""
     except Exception as e:
         success, message = False, str(e)
     resp.body = json.dumps({"success": success, "message": message})
Exemplo n.º 5
0
    def on_get(self, req, resp):
        try:
            self.PF = PathFinder()
            self.sm = StatMaster()
            image_info = self.sm.get_image_info()
            label_info = self.sm.get_label_info()
            bound_box_leak = self.sm.check_bounding_box_leak()
            content = {
                'imageInfo': image_info,
                'labelInfo': label_info,
                'boundBoxLeak': bound_box_leak
            }
            success, message = True, ""
        except Exception as e:
            content, success, message = {}, False, str(e)

        data = {'data': content, 'success': success, 'message': message}
        resp.body = json.dumps(data)
Exemplo n.º 6
0
import xml.etree.ElementTree as ET
import pickle as pkl
import numpy as np
import random
import cv2
import os

from data_aug.bbox_util import *
from data_aug.data_aug import *

from utils.xml_utils import XMLEditor
from utils.txt_utils import EditTextFile

from augment_utils import randomTransform, transform_image
from utils.path_manager import PathFinder
PF = PathFinder()


def augment(ipath, annotation_path, outname, image_name, image_format,
            transform):

    img = cv2.imread(ipath)
    height, width, _ = img.shape

    if PF.annotationFormat == 'xml':
        XE = XMLEditor(annotation_path)
        bounding_box_list = XE.get_bounding_box()
        """Transform Boxes for randomTransform"""
        original_boxes, names = [], []
        for i, b in enumerate(bounding_box_list):
            bbox = np.array([b['xmin'], b['ymin'], b['xmax'], b['ymax'], i])