From 12846d890a5bf224b0a800d10afb3110dacee165 Mon Sep 17 00:00:00 2001 From: niten Date: Sat, 7 Jan 2023 15:54:52 -0800 Subject: [PATCH] Remove stupid cache --- src/__pycache__/detector.cpython-310.pyc | Bin 3397 -> 0 bytes src/__pycache__/objectifier.cpython-310.pyc | Bin 2550 -> 0 bytes src/detector.py | 126 -------------------- 3 files changed, 126 deletions(-) delete mode 100644 src/__pycache__/detector.cpython-310.pyc delete mode 100644 src/__pycache__/objectifier.cpython-310.pyc mode change 100755 => 100644 src/detector.py diff --git a/src/__pycache__/detector.cpython-310.pyc b/src/__pycache__/detector.cpython-310.pyc deleted file mode 100644 index 24458ca36d18c4ec335e85686539b1fb5202485b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3397 zcma)9TaO$^74GW$Tz7Z8_w{8-2xxFvMq{b0vvsOY-MY>>Uwu`Z zHyTv~>94DQ?*8JEVSGu-^T~p83%Pg*!41w*BVf8T151~7VC&Ke9F%72j=aEQ)3JWw z>%K}*L20GcQ7x!3;j8q3lxY^T~vA3;F3fM6CB2n4DpsCbu3N*r$!v996j;mvOgD^6cp9C-GRsMVytz zc9d=BdqZ?=a|rt5+et>v$tdc_J6#*g&Jxw>d+#F`s}Pb&BQ&H5$)p8oa%0zc!a8kB zIcc;Pr>fe`vtGjEtQ#w9FF$D8$}ZxxCp^p-K8Xs%6GPNc{CoS_ARooovZRc&YlnH7 zUn@lS8rOTz#m@Lp`C*u#I}8^wzHlL2=CUd~YRxU&nGNYYacF!Njp8s=)i508d_Sdn zJq#c0N9nU3FARC!4MWkua(W}ri8{485Y+jUKIj`ZtDCy*YvUovS@3(~y(~%(k79m@ z{CV{5{Xx79=kKTGcHY|_$D)^uQIhq~!|*Ij+xh<$2J(UqfT05bnC=>aHrX~+b?P_7 zyii`gU-ptTZrg&uuY6L-e6a#mP&8k*nd~K06=aHb@#+i4oV!^xUz|>%6xwggsOb+} zpeE8@@tB3iTgb(m5HBFO$}Mg`X27t+U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v6)2Hke*`rg(i?YfULp+l8LIFCw@SQ`}G^ zP_Ki>RRaYg+jIN!OM-y+L|ct>Coh&{>;VJvI7Wn4u9$^t)AB2Po7@ z8F;E(B=$G`?)=kLuT0c?FlBh*KOVdIZQ;5W8h+Fu9AQ>GC#_B#YCRWDb5Z#Q=z}-} z&MELg3>~{UnGjVgh?^mra)Ochhyr=D-RLI>#o-cKxshgOqniy`AeL8=DK*0B46TwXAPF-_XaQThfnT%; VrIbt)aJR=Oj8y}Fl~ikW@(;+saZvyO diff --git a/src/detector.py b/src/detector.py old mode 100755 new mode 100644 index 5c61aed..26567be --- a/src/detector.py +++ b/src/detector.py @@ -85,129 +85,3 @@ class Detector: out_file = output_filename if output_filename else self.output_filename(filename) cv.imwrite(out_file, marked) return AnalyzedImage(filename, detections, str(out_file)) - - - - -# net = cv.dnn.readNet("/home/niten/Projects/yolo/yolov3.weights", "/home/niten/Projects/yolo/yolov3.cfg") - -# classes = [] - -# with open("/home/niten/Projects/yolo/coco.names") as f: -# classes = [line.strip() for line in f.readlines()] - -# layer_names = net.getLayerNames() -# output_layer = [layer_names[i - 1] for i in net.getUnconnectedOutLayers()] -# colors = np.random.uniform(0, 255, size=(len(classes), 3)) - -# def scale_int(o, s, m): -# return (m / s) * o - -# def scale_box(orig, scaled, box): -# o_h, o_w, _ = orig.shape -# s_h, s_w, _ = scaled.shape -# x, y, w, h = box -# return [scale_int(o_w, s_w, x), -# scale_int(o_h, s_h, y), -# scale_int(o_w, o_h, w), -# scale_int(o_h, s_h, h)] - -# tmpdir = Path(tempfile.mkdtemp()) - -# def detect_objects(filename): -# simplename = path.splitext(path.basename(filename))[0] -# out_filename = tmpdir / ("processed_" + simplename + ".png") - -# orig = cv.imread(str(filename)) -# img = cv.imread(str(filename)) -# # img = cv.resize(img, None, fx=0.4, fy=0.4) -# height, width, channel = img.shape -# # TODO: Change scale factor? -# blob = cv.dnn.blobFromImage(img, 0.00392, (416, 416), (0, 0, 0), True, crop=False) -# net.setInput(blob) -# outs = net.forward(output_layer) - -# class_ids = [] -# confidences = [] -# boxes = [] - -# detections = [] - -# for out in outs: -# for detection in out: -# scores = detection[5:] -# class_id = np.argmax(scores) -# confidence = scores[class_id] -# if confidence > 0.6: -# center_x = int(detection[0] * width) -# center_y = int(detection[1] * height) -# w = int(detection[2] * width) -# h = int(detection[3] * height) -# x = int(center_x - w/2) -# y = int(center_y - h/2) -# boxes.append([x, y, w, h]) -# confidences.append(float(confidence)) -# class_ids.append(class_id) - -# indexes = cv.dnn.NMSBoxes(boxes, confidences, 0.5, 0.4) - -# font = cv.FONT_HERSHEY_PLAIN -# for i in range(len(boxes)): -# if i in indexes: -# label = str(classes[class_ids[i]]) -# color = colors[i] -# scaled_box = scale_box(orig, img, boxes[i]) -# x, y, w, h = [int(n) for n in scaled_box] -# detections.append(Detection(label, confidences[i], scaled_box)) -# # cv.rectangle(out, (x, y), (x + w, y + h), color, 2) -# # cv.putText(out, label, (x, y + 30), font, 3, color, 3) - -# #cv.imwrite(str(out_filename), out) -# marked = cv.imread(filename) -# for detection in detections: -# x, y, w, h = [int(n) for n in detection.box] -# cv.rectangle(marked, (x,y), (x + w, y + h), (255,255,255,0), 2) -# cv.putText(marked, detection.label, (x, y + 30), font, 3, (255,255,255,0), 1) - -# cv.imwrite(str(out_filename), marked) -# return AnalyzedImage(filename, detections, str(out_filename)) - -# # cv.imshow("IMG", img) -# # cv.waitKey(0) -# # cv.destroyAllWindows() - -# for filename in sys.argv[1:]: -# print(filename + ":") -# output = detect_objects(filename) -# print(" OUTPUT: " + str(output.outfile)) -# for detection in output.detections: -# print(" " + detection.label + -# " (" + str(detection.confidence) + ")" + -# " [" + -# str(detection.box[0]) + ", " + -# str(detection.box[1]) + ", " + -# str(detection.box[2]) + ", " + -# str(detection.box[3]) + -# "]") - - -# classes = [] - -# with open("/home/niten/Projects/yolo/coco.names") as f: -# classes = [line.strip() for line in f.readlines()] - -# detector = Detector("/home/niten/Projects/yolo/yolov3.weights", "/home/niten/Projects/yolo/yolov3.cfg", classes, Path(tempfile.mkdtemp())) - -# for filename in sys.argv[1:]: -# print(filename + ":") -# output = detector.detect_objects(filename) -# print(" OUTPUT: " + str(output.outfile)) -# for detection in output.detections: -# print(" " + detection.label + -# " (" + str(detection.confidence) + ")" + -# " [" + -# str(detection.box[0]) + ", " + -# str(detection.box[1]) + ", " + -# str(detection.box[2]) + ", " + -# str(detection.box[3]) + -# "]")