Page 501 - 2020학년도 MDP과제발표회 자료집 (통신과) (3)
P. 501
2. 코드
1) 시바 인식 – WebYolo.py
from __future__ import division
import time
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import cv2
from util import *
from darknet import Darknet
from preprocess import prep_image, inp_to_image
import pandas as pd
import random
import argparse
import pickle as pkl
class PytorchYolo:
label_list = list()
classes = ""
color = 0
web_address = ""
detect_object = ""
def __init__(self, web_address, detect_object):
self.web_address = web_address
self.detect_object = detect_object
print("Pytorch is Ready!")
def __del__(self):
print("")
def prep_image(self, img, inp_dim):
"""
Prepare image for inputting to the neural network.
Returns a Variable
"""
인천전자마이스터고등학교
- 523 - 정보통신기기과 523