We could really use AI's help

Anything, really ANYTHING that comes up in your brain!!!

Moderator: Moderators

Post Reply
Feet_Guy129
Posts: 22
Joined: Tue Feb 08, 2022 10:21 am

We could really use AI's help

Post by Feet_Guy129 »

Before you start thinking that I'm talking about AI-generated feet pics, no. That's not what I'm talking about. What I'm talking about is some kind of AI that can skim through youtube videos and try to locate any feet in them. Imagine just queuing a bunch of videos that you suspect have feet in them, and the Ai just looks thru all of them and then notifies you of timestamps where it thinks it found feet. it would have to be very good at it of course so it has little chance of missing a shot or two.


Hamilton
Posts: 58
Joined: Mon Dec 30, 2019 6:10 pm
Location: USA

Re: We could really use AI's help

Post by Hamilton »

You're talking about a machine learning algorithm. How much data do you have and how much computing power do you have. You have to have a training data set and then a test data set before you can successfully work on actual data. Images require a lot of processing let alone a video or a streaming video. You would probably have more success on a single image. I suspect streaming video would be very difficult because of packetization and codecs and we haven't even touched the time indexing aspect.
Hamilton
Posts: 58
Joined: Mon Dec 30, 2019 6:10 pm
Location: USA

Re: We could really use AI's help

Post by Hamilton »

import cv2
import numpy as np

def load_yolo():
net = cv2.dnn.readNet("yolov3.weights", "yolov3.cfg")
classes = []
with open("coco.names", "r") as f:
classes = [line.strip() for line in f.readlines()]
layers_names = net.getLayerNames()
output_layers = [layers_names[i[0] - 1] for i in net.getUnconnectedOutLayers()]
return net, classes, output_layers

def detect_objects(img, net, output_layers):
blob = cv2.dnn.blobFromImage(img, scalefactor=0.00392, size=(416, 416), mean=(0, 0, 0), swapRB=True, crop=False)
net.setInput(blob)
outs = net.forward(output_layers)
return blob, outs

def get_box_dimensions(outs, height, width):
class_ids = []
confidences = []
boxes = []
for out in outs:
for detection in out:
scores = detection[5:]
class_id = np.argmax(scores)
confidence = scores[class_id]
if confidence > 0.5 and class_id == 0: # 0 represents 'person' class
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)
return class_ids, confidences, boxes

def draw_labels(boxes, confidences, class_ids, classes, img):
for i in range(len(boxes)):
x, y, w, h = boxes
label = str(classes[class_ids])
confidence = confidences
cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2)
cv2.putText(img, label + f" {confidence:.2f}", (x, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)

def main(image_path):
net, classes, output_layers = load_yolo()
img = cv2.imread(image_path)
height, width, channels = img.shape
blob, outs = detect_objects(img, net, output_layers)
class_ids, confidences, boxes = get_box_dimensions(outs, height, width)
draw_labels(boxes, confidences, class_ids, classes, img)
cv2.imshow("Image", img)
cv2.waitKey(0)
cv2.destroyAllWindows()

if __name__ == "__main__":
image_path = "path/to/your/image.jpg" # Replace with the path to your image
main(image_path)
User avatar
tobydole
Posts: 141
Joined: Mon Oct 24, 2016 9:18 pm

Re: We could really use AI's help

Post by tobydole »

Lots and lots and lots and LOTS of images on Flickr, the majority in quite high resolution. Loads of unintentional shoeless hose, shoeplay and the usual bare/socked feet options too. Would be cool to do something with that I guess lol
Post Reply