Beispiel #1
0
def predownload(nnDir):
    import os
    import sys
    # change this property
    NOMEROFF_NET_DIR = os.path.abspath(nnDir)
    sys.path.append(NOMEROFF_NET_DIR)

    from NomeroffNet.YoloV5Detector import Detector

    detector = Detector()
    detector.load()

    from NomeroffNet.BBoxNpPoints import NpPointsCraft, getCvZoneRGB, convertCvZonesRGBtoBGR, reshapePoints
    npPointsCraft = NpPointsCraft()
    npPointsCraft.load()

    from NomeroffNet.OptionsDetector import OptionsDetector
    from NomeroffNet.TextDetector import TextDetector
    from NomeroffNet.TextPostprocessing import textPostprocessing

    # load models
    optionsDetector = OptionsDetector()
    optionsDetector.load("latest")

    textDetector = TextDetector.get_static_module("eu")()
    textDetector.load("latest")

    return npPointsCraft, optionsDetector, textDetector, detector
Beispiel #2
0
# Import all necessary libraries.
import sys
import traceback
import cv2
import ujson
import copy

# NomeroffNet path
NOMEROFF_NET_DIR = os.path.abspath('../../../')
sys.path.append(NOMEROFF_NET_DIR)

from NomeroffNet import __version__
from NomeroffNet.YoloV5Detector import Detector

detector = Detector()
detector.load()

from NomeroffNet.BBoxNpPoints import (NpPointsCraft, getCvZoneRGB,
                                      convertCvZonesRGBtoBGR, reshapePoints)

npPointsCraft = NpPointsCraft()
npPointsCraft.load()

from NomeroffNet.OptionsDetector import OptionsDetector
from NomeroffNet.TextDetector import TextDetector

optionsDetector = OptionsDetector()
optionsDetector.load("latest")

# Initialize text detector.
Beispiel #3
0
os.environ["CUDA_VISIBLE_DEVICES"] = "0"

# Import all necessary libraries.
import sys
import glob
import matplotlib.image as mpimg
import cv2
import copy

# NomeroffNet path
NOMEROFF_NET_DIR = os.path.abspath('../../')
sys.path.append(NOMEROFF_NET_DIR)

from NomeroffNet.YoloV5Detector import Detector

detector = Detector()
detector.load()

rootDir = '../images/*'

imgs = [mpimg.imread(img_path) for img_path in glob.glob(rootDir)]

for img in imgs:
    targetBoxes = detector.detect_bbox(copy.deepcopy(img))
    targetBoxes = targetBoxes

    # draw rect and 4 points
    for targetBox in targetBoxes:
        cv2.rectangle(img, (int(targetBox[0]), int(targetBox[1])),
                      (int(targetBox[2]), int(targetBox[3])), (0, 0, 0), -1)
    cv2.imshow("Display window", img)
Beispiel #4
0
import os

os.environ["CUDA_VISIBLE_DEVICES"] = "0"

# Import all necessary libraries.
import sys
import cv2

# NomeroffNet path
NOMEROFF_NET_DIR = os.path.abspath('../../')

sys.path.append(NOMEROFF_NET_DIR)

# Import license plate recognition tools.
from NomeroffNet.YoloV5Detector import Detector
detector = Detector()
detector.load()

from NomeroffNet.TextDetectors.eu import eu
from NomeroffNet.TextPostprocessing import textPostprocessing

# load models
textDetector = eu
textDetector.load("latest")

# Detect numberplate
img_path = '../images/example2.jpeg'
img = cv2.imread(img_path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

targetBoxes = detector.detect_bbox(img)