CabConModding
Facebook
Twitter
youtube
Discord
Contact us
RSS
Menu
CabConModding
Home
New
Top
Premium
Rules
FAQ - Frequently Asked Questions
Games
Fornite
Call of Duty: Black Ops 3
Clash of Clans
Grand Theft Auto 5
Apex Legends
Assassin’s Creed Origins
Forums
Premium
Latest posts
What's new
Latest posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Log in
Register
What's new
Premium
Latest posts
Menu
Log in
Register
Navigation
Install the app
Install
More options
Dark Theme
Contact us
Close Menu
Join the Fortnite Facebook Group!
Join our facebook group now and discuss, request and browse the latest Fortnite Accounts, Hacks, Mods and Cheats
Forums
Gaming
Fortnite
Fortnite Cheats, Hacks and Mods
Fortnite Neural Network Python Hack +Tutorial How to install?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="genesis" data-source="post: 50338" data-attributes="member: 341000"><p>I reindent your code and updated it for python 3 but I'have just one problem with the following path in lines 28 and 29 :</p><p></p><p>prott1 = r'C:\Users\ianyy\Documents\MobileNetSSD_deploy.prototxt.txt'</p><p>prott2 = r'C:\Users\ianyy\Documents\MobileNetSSD_deploy.caffemodel'</p><p></p><p>I know that I must change them with my computer session but the major problem is that You don't give us the 2 files that are :</p><p></p><p>MobileNetSSD_deploy.prototxt.txt and MobileNetSSD_deploy.caffemodel.</p><p></p><p>Can you give them to the community thx in advance or not XD.</p><p></p><p>For the peoples who want the right code in python 3 and + (line 28 and 29 are to change <img src="/styles/default/xenforo/smilies.emoji/people/wink.emoji.svg" class="smilie" loading="lazy" alt=":wink:" title="Wink :wink:" data-shortname=":wink:" /> ) N.B. if the indentation goes off with the publication you just need to push over the touch Tab in your atom editor with your code <img src="/styles/default/xenforo/smilies.emoji/people/slight_smile.emoji.svg" class="smilie" loading="lazy" alt=":smile:" title="Smile :smile:" data-shortname=":smile:" /> :</p><p></p><p># USAGE</p><p># python real_time_object_detection.py --prototxt MobileNetSSD_deploy.prototxt.txt --model MobileNetSSD_deploy.caffemodel</p><p># import the necessary packages</p><p>import win32api</p><p>import keyboard as keyboard</p><p>import pygame as pygame</p><p>import pythoncom</p><p>import win32con</p><p>from PIL import ImageGrab</p><p>from imutils.video import VideoStream</p><p>from imutils.video import FPS</p><p>import numpy as np</p><p>import argparse</p><p>import imutils</p><p>import time</p><p>import cv2</p><p>import pyautogui</p><p># construct the argument parse and parse the arguments</p><p>from keyboard._mouse_event import RIGHT</p><p>ap = argparse.ArgumentParser()</p><p>ap.add_argument("-p", "--prototxt", required=False,</p><p> help="path to Caffe 'deploy' prototxt file")</p><p>ap.add_argument("-m", "--model", required=False,</p><p> help="path to Caffe pre-trained model")</p><p>ap.add_argument("-c", "--confidence", type=float, default=0.6,</p><p> help="minimum probability to filter weak detections")</p><p>args = vars(ap.parse_args())</p><p>prott1 = r'C:\Users\ianyy\Documents\MobileNetSSD_deploy.prototxt.txt'</p><p>prott2 = r'C:\Users\ianyy\Documents\MobileNetSSD_deploy.caffemodel'</p><p># initialize the list of class labels MobileNet SSD was trained to</p><p># detect, then generate a set of bounding box colors for each class</p><p>CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",</p><p> "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",</p><p> "dog", "horse", "motorbike", "person", "pottedplant", "sheep",</p><p> "sofa", "train", "tvmonitor"]</p><p>COLORS = np.random.uniform(0, 255, size=(len(CLASSES), 3))</p><p># load our serialized model from disk</p><p>print("[INFO] loading model...")</p><p>net = cv2.dnn.readNetFromCaffe(prott1, prott2)</p><p># initialize the video stream, allow the cammera sensor to warmup,</p><p># and initialize the FPS counter</p><p>print("[INFO] starting video stream...")</p><p>vs = VideoStream(src=0).start()</p><p>time.sleep(2.0)</p><p>fps = FPS().start()</p><p># loop over the frames from the video stream</p><p>HSX = 100;</p><p>LSX = 1000;</p><p>HSY = 100;</p><p>LSY = 1000;</p><p>HEX = 100;</p><p>LEX = 1000;</p><p>HEY = 100;</p><p>LEY = 1000;</p><p>while True:</p><p> # grab the frame from the threaded video stream and resize it</p><p> # to have a maximum width of 400 pixels</p><p> frame = np.array(ImageGrab.grab(bbox=(0, 40, 1820, 1240)))</p><p> # frame = imutils.resize(frame, width=400)</p><p> # grab the frame dimensions and convert it to a blob</p><p> (h, w) = frame.shape[:2]</p><p> blob = cv2.dnn.blobFromImage(cv2.resize(frame, (300, 300)),</p><p> 0.007843, (300, 300), 127.5)</p><p> # pass the blob through the network and obtain the detections and</p><p> # predictions</p><p> net.setInput(blob)</p><p> detections = net.forward()</p><p> # loop over the detections</p><p> for i in np.arange(0, detections.shape[2]):</p><p> # extract the confidence (i.e., probability) associated with</p><p> # the prediction</p><p> confidence = detections[0, 0, i, 2]</p><p> # filter out weak detections by ensuring the `confidence` is</p><p> # greater than the minimum confidence</p><p> if confidence > args["confidence"]:</p><p> # extract the index of the class label from the</p><p> # `detections`, then compute the (x, y)-coordinates of</p><p> # the bounding box for the object</p><p> idx = int(detections[0, 0, i, 1])</p><p> box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])</p><p> (startX, startY, endX, endY) = box.astype("int")</p><p> # draw the prediction on the frame</p><p> label = "{}: {:.2f}%".format(CLASSES[idx],</p><p> confidence * 100)</p><p> cv2.rectangle(frame, (startX, startY), (endX, endY),</p><p> COLORS[idx], 2)</p><p> y = startY - 15 if startY - 15 > 15 else startY + 15</p><p> cv2.putText(frame, label, (startX, y),</p><p> cv2.FONT_HERSHEY_SIMPLEX, 0.5, COLORS[idx], 2)</p><p> if 'person' in label:</p><p> pygame.init()</p><p> pygame.event.get()</p><p> if pygame.mouse.get_pressed():</p><p> print ('pressing')</p><p> #tried to detect my character's offset and add the best way to exclude it, failed most tests.</p><p> if startX > 369 & startX < 1402 & startY > -1 & startY < 725 & endX > 339 & endX < 1805 & endY > 806 & endY < 1017:</p><p> print ('found myself')</p><p> else:</p><p> #print 'found somebody else'</p><p> nosum = int(round(startX * 1)) + int(round(startX * 0.06))</p><p> nosum2 = int(round(y * 1)) + int(round(y * 0.7))</p><p> halfX = (endX - startX) / 2</p><p> halfY = (endY - startY) / 2</p><p> finalX = startX + halfX</p><p> finalY = startY + halfY</p><p> pyautogui.moveTo(finalX, finalY)</p><p> win32api.SetCursorPos((finalX, finalY))</p><p> win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, finalX, finalY, 0, 0)</p><p> win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, finalX, finalY, 0, 0)</p><p> print ('Pressed L')</p><p> if 'HSX' not in locals():</p><p> HSX = startX</p><p> if 'LSX' not in locals():</p><p> LSX = startX</p><p> if 'HSY' not in locals():</p><p> HSY = startY</p><p> if 'LSY' not in locals():</p><p> LSY = startY</p><p> if 'HEX' not in locals():</p><p> HEX = endX</p><p> if 'LEX' not in locals():</p><p> LEX = endX</p><p> if 'HEY' not in locals():</p><p> HEY = endY</p><p> if 'LEY' not in locals():</p><p> LEY = endY</p><p> if startX > HSX:</p><p> HSX = startX</p><p> if startX < LSX:</p><p> LSX = startX</p><p> if startY > HSY:</p><p> HSY = startY</p><p> if startY < LSY:</p><p> LSY = startY</p><p> if endX > HEX:</p><p> HEX = endX</p><p> if endX < LEX:</p><p> LEX = endX</p><p> if endY > HEY:</p><p> HEY = endY</p><p> if endY < LEY:</p><p> LEY = endY</p><p> print ('HStartX: ' + str(HSX))</p><p> print ('LStartX: ' + str(LSX))</p><p> print ('HStartY: ' + str(HSY))</p><p> print ('LStartY: ' + str(LSY))</p><p> print ('HendX: ' + str(HEX))</p><p> print ('LendX: ' + str(LEX))</p><p> print ('HendY: ' + str(HEY))</p><p> print ('LendY: ' + str(LEY))</p><p> print (args["confidence"])</p><p> click(10,10)</p><p> # show the output frame</p><p> cv2.imshow("Frame", frame)</p><p> key = cv2.waitKey(1) & 0xFF</p><p> # if the `k` key was pressed, break from the loop</p><p> if key == ord("k"):</p><p> break</p><p> # update the FPS counter</p><p> # stop the timer and display FPS information</p><p> # do a bit of cleanup</p><p> cv2.destroyAllWindows()</p></blockquote><p></p>
[QUOTE="genesis, post: 50338, member: 341000"] I reindent your code and updated it for python 3 but I'have just one problem with the following path in lines 28 and 29 : prott1 = r'C:\Users\ianyy\Documents\MobileNetSSD_deploy.prototxt.txt' prott2 = r'C:\Users\ianyy\Documents\MobileNetSSD_deploy.caffemodel' I know that I must change them with my computer session but the major problem is that You don't give us the 2 files that are : MobileNetSSD_deploy.prototxt.txt and MobileNetSSD_deploy.caffemodel. Can you give them to the community thx in advance or not XD. For the peoples who want the right code in python 3 and + (line 28 and 29 are to change :wink: ) N.B. if the indentation goes off with the publication you just need to push over the touch Tab in your atom editor with your code :) : # USAGE # python real_time_object_detection.py --prototxt MobileNetSSD_deploy.prototxt.txt --model MobileNetSSD_deploy.caffemodel # import the necessary packages import win32api import keyboard as keyboard import pygame as pygame import pythoncom import win32con from PIL import ImageGrab from imutils.video import VideoStream from imutils.video import FPS import numpy as np import argparse import imutils import time import cv2 import pyautogui # construct the argument parse and parse the arguments from keyboard._mouse_event import RIGHT ap = argparse.ArgumentParser() ap.add_argument("-p", "--prototxt", required=False, help="path to Caffe 'deploy' prototxt file") ap.add_argument("-m", "--model", required=False, help="path to Caffe pre-trained model") ap.add_argument("-c", "--confidence", type=float, default=0.6, help="minimum probability to filter weak detections") args = vars(ap.parse_args()) prott1 = r'C:\Users\ianyy\Documents\MobileNetSSD_deploy.prototxt.txt' prott2 = r'C:\Users\ianyy\Documents\MobileNetSSD_deploy.caffemodel' # initialize the list of class labels MobileNet SSD was trained to # detect, then generate a set of bounding box colors for each class CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow", "diningtable", "dog", "horse", "motorbike", "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor"] COLORS = np.random.uniform(0, 255, size=(len(CLASSES), 3)) # load our serialized model from disk print("[INFO] loading model...") net = cv2.dnn.readNetFromCaffe(prott1, prott2) # initialize the video stream, allow the cammera sensor to warmup, # and initialize the FPS counter print("[INFO] starting video stream...") vs = VideoStream(src=0).start() time.sleep(2.0) fps = FPS().start() # loop over the frames from the video stream HSX = 100; LSX = 1000; HSY = 100; LSY = 1000; HEX = 100; LEX = 1000; HEY = 100; LEY = 1000; while True: # grab the frame from the threaded video stream and resize it # to have a maximum width of 400 pixels frame = np.array(ImageGrab.grab(bbox=(0, 40, 1820, 1240))) # frame = imutils.resize(frame, width=400) # grab the frame dimensions and convert it to a blob (h, w) = frame.shape[:2] blob = cv2.dnn.blobFromImage(cv2.resize(frame, (300, 300)), 0.007843, (300, 300), 127.5) # pass the blob through the network and obtain the detections and # predictions net.setInput(blob) detections = net.forward() # loop over the detections for i in np.arange(0, detections.shape[2]): # extract the confidence (i.e., probability) associated with # the prediction confidence = detections[0, 0, i, 2] # filter out weak detections by ensuring the `confidence` is # greater than the minimum confidence if confidence > args["confidence"]: # extract the index of the class label from the # `detections`, then compute the (x, y)-coordinates of # the bounding box for the object idx = int(detections[0, 0, i, 1]) box = detections[0, 0, i, 3:7] * np.array([w, h, w, h]) (startX, startY, endX, endY) = box.astype("int") # draw the prediction on the frame label = "{}: {:.2f}%".format(CLASSES[idx], confidence * 100) cv2.rectangle(frame, (startX, startY), (endX, endY), COLORS[idx], 2) y = startY - 15 if startY - 15 > 15 else startY + 15 cv2.putText(frame, label, (startX, y), cv2.FONT_HERSHEY_SIMPLEX, 0.5, COLORS[idx], 2) if 'person' in label: pygame.init() pygame.event.get() if pygame.mouse.get_pressed(): print ('pressing') #tried to detect my character's offset and add the best way to exclude it, failed most tests. if startX > 369 & startX < 1402 & startY > -1 & startY < 725 & endX > 339 & endX < 1805 & endY > 806 & endY < 1017: print ('found myself') else: #print 'found somebody else' nosum = int(round(startX * 1)) + int(round(startX * 0.06)) nosum2 = int(round(y * 1)) + int(round(y * 0.7)) halfX = (endX - startX) / 2 halfY = (endY - startY) / 2 finalX = startX + halfX finalY = startY + halfY pyautogui.moveTo(finalX, finalY) win32api.SetCursorPos((finalX, finalY)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, finalX, finalY, 0, 0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, finalX, finalY, 0, 0) print ('Pressed L') if 'HSX' not in locals(): HSX = startX if 'LSX' not in locals(): LSX = startX if 'HSY' not in locals(): HSY = startY if 'LSY' not in locals(): LSY = startY if 'HEX' not in locals(): HEX = endX if 'LEX' not in locals(): LEX = endX if 'HEY' not in locals(): HEY = endY if 'LEY' not in locals(): LEY = endY if startX > HSX: HSX = startX if startX < LSX: LSX = startX if startY > HSY: HSY = startY if startY < LSY: LSY = startY if endX > HEX: HEX = endX if endX < LEX: LEX = endX if endY > HEY: HEY = endY if endY < LEY: LEY = endY print ('HStartX: ' + str(HSX)) print ('LStartX: ' + str(LSX)) print ('HStartY: ' + str(HSY)) print ('LStartY: ' + str(LSY)) print ('HendX: ' + str(HEX)) print ('LendX: ' + str(LEX)) print ('HendY: ' + str(HEY)) print ('LendY: ' + str(LEY)) print (args["confidence"]) click(10,10) # show the output frame cv2.imshow("Frame", frame) key = cv2.waitKey(1) & 0xFF # if the `k` key was pressed, break from the loop if key == ord("k"): break # update the FPS counter # stop the timer and display FPS information # do a bit of cleanup cv2.destroyAllWindows() [/QUOTE]
Verification
Post reply
Forums
Gaming
Fortnite
Fortnite Cheats, Hacks and Mods
Fortnite Neural Network Python Hack +Tutorial How to install?
CabConModding is now on facebook! Check the latest Updates, the Site Status and much more now!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top