This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import argparse | |
import time | |
import cv2 | |
import os | |
confthres=0.5 | |
nmsthres=0.1 | |
path="./" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_labels(labels_path): | |
# load the COCO class labels our YOLO model was trained on | |
#labelsPath = os.path.sep.join([yolo_path, "yolo_v3/coco.names"]) | |
lpath=os.path.sep.join([yolo_path, labels_path]) | |
LABELS = open(lpath).read().strip().split("\n") | |
return LABELS | |
def get_colors(LABELS): | |
# initialize a list of colors to represent each possible class label | |
np.random.seed(42) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_predection(image,net,LABELS,COLORS): | |
(H, W) = image.shape[:2] | |
# determine only the *output* layer names that we need from YOLO | |
ln = net.getLayerNames() | |
ln = [ln[i[0] - 1] for i in net.getUnconnectedOutLayers()] | |
# construct a blob from the input image and then perform a forward | |
# pass of the YOLO object detector, giving us our bounding boxes and | |
# associated probabilities |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main(): | |
# load our input image and grab its spatial dimensions | |
image = cv2.imread("./test1.jpg") | |
labelsPath="yolo_v3/coco.names" | |
cfgpath="yolo_v3/yolov3.cfg" | |
wpath="yolo_v3/yolov3.weights" | |
Lables=get_labels(labelsPath) | |
CFG=get_config(cfgpath) | |
Weights=get_weights(wpath) | |
nets=load_model(CFG,Weights) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @Author: Dwivedi Chandan | |
# @Date: 2019-08-05T13:35:05+05:30 | |
# @Email: [email protected] | |
# @Last modified by: Dwivedi Chandan | |
# @Last modified time: 2019-08-07T11:52:45+05:30 | |
# import the necessary packages | |
import numpy as np | |
import argparse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import seaborn as sns | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
df1=pd.read_csv("./x01.csv") | |
df1.columns=["Index","Brain_weight","Body_weight"] | |
corr_data = df1.corr() #we are using pandas library's corr() function to find correlation. | |
print(corr_data) | |
plt.figure(figsize=(9,5)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import * | |
# y = mx + b | |
# m is slope, b is y-intercept | |
# point is tuple of x,y value at a given step with data as points[i]= [xi, yi] | |
def compute_error_for_line_given_points(b, m, points): | |
totalError = 0 | |
for i in range(0, len(points)): | |
x = points[i, 0] | |
y = points[i, 1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def step_gradient(b_current, m_current, points, learningRate): | |
b_gradient = 0 | |
m_gradient = 0 | |
N = float(len(points)) | |
for i in range(0, len(points)): | |
x = points[i, 0] | |
y = points[i, 1] | |
b_gradient += -(2/N) * (y - ((m_current * x) + b_current)) | |
m_gradient += -(2/N) * x * (y - ((m_current * x) + b_current)) | |
new_b = b_current - (learningRate * b_gradient) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run_lr(res,data): | |
# Note: data should be given in pandas format, as shwon below: | |
''' | |
Brain_weight Body_weight | |
62.00 1320.0 | |
55.50 175.0 | |
35.00 56.0 | |
52.16 440.0 | |
0.28 1.9 | |
''' |
OlderNewer