コード例 #1
0
"""
import argparse
import collections
import itertools
import time

from edgetpu.classification.engine import ClassificationEngine

import svg
import utils
# from apps import run_app

CSS_STYLES = str(
    svg.CssStyle({
        '.back':
        svg.Style(fill='black', stroke='black', stroke_width='0.5em')
    }))


def size_em(length):
    return '%sem' % str(0.6 * (length + 1))


def overlay(title, results, inference_time, inference_rate, layout):
    x0, y0, width, height = layout.window
    font_size = 0.03 * height

    defs = svg.Defs()
    defs += CSS_STYLES

    doc = svg.Svg(width=width,
コード例 #2
0
import colorsys
import itertools
import time

from collections import deque

from edgetpu.detection.engine import DetectionEngine

import svg
import utils
from apps import run_app

CSS_STYLES = str(
    svg.CssStyle({
        '.back':
        svg.Style(fill='black', stroke='black', stroke_width='1em'),
        '.bbox':
        svg.Style(fill_opacity=0.0, stroke_width='2px')
    }))

BBox = collections.namedtuple('BBox', ('x', 'y', 'w', 'h'))
BBox.area = lambda self: self.w * self.h
BBox.scale = lambda self, sx, sy: BBox(
    x=self.x * sx, y=self.y * sy, w=self.w * sx, h=self.h * sy)
BBox.__str__ = lambda self: 'BBox(x=%.2f y=%.2f w=%.2f h=%.2f)' % self

Object = collections.namedtuple('Object', ('id', 'label', 'score', 'bbox'))
Object.__str__ = lambda self: 'Object(id=%d, label=%s, score=%.2f, %s)' % self

centerPts = deque(maxlen=30)
コード例 #3
0
  --labels ${TEST_DATA}/inat_bird_labels.txt
"""
import argparse
import collections
import itertools
import time

from edgetpu.classification.engine import ClassificationEngine

import svg
import utils
from apps import run_app


CSS_STYLES = str(svg.CssStyle({'.back': svg.Style(fill='black',
                                                  stroke='black',
                                                  stroke_width='0.5em')}))

def size_em(length):
    return '%sem' % str(0.6 * (length + 1))

def overlay(title, results, inference_time, inference_rate, layout):
    x0, y0, width, height = layout.window
    font_size = 0.03 * height

    defs = svg.Defs()
    defs += CSS_STYLES

    doc = svg.Svg(width=width, height=height,
                  viewBox='%s %s %s %s' % layout.window,
                  font_size=font_size, font_family='monospace', font_weight=500)
コード例 #4
0
"""

import argparse
import collections
import colorsys
import itertools
import time

from edgetpu.detection.engine import DetectionEngine

import svg
import utils
from apps import run_app

CSS_STYLES = str(svg.CssStyle({'.back': svg.Style(fill='black',
                                                  stroke='black',
                                                  stroke_width='0.5em'),
                               '.bbox': svg.Style(fill_opacity=0.0,
                                                  stroke_width='0.1em')}))

BBox = collections.namedtuple('BBox', ('x', 'y', 'w', 'h'))
BBox.area = lambda self: self.w * self.h
BBox.scale = lambda self, sx, sy: BBox(x=self.x * sx, y=self.y * sy,
                                       w=self.w * sx, h=self.h * sy)
BBox.__str__ = lambda self: 'BBox(x=%.2f y=%.2f w=%.2f h=%.2f)' % self

Object = collections.namedtuple('Object', ('id', 'label', 'score', 'bbox'))
Object.__str__ = lambda self: 'Object(id=%d, label=%s, score=%.2f, %s)' % self

def size_em(length):
    return '%sem' % str(0.6 * length)
コード例 #5
0
 def __init__(self):
     self.title = svg.Style(font=svg.SansSerif('12px'))
     self.outline = svg.Style(stroke="grey", fill="None", stroke_width=2)