petercunha / Pine

:evergreen_tree: Aimbot powered by real-time object detection with neural networks, GPU accelerated with Nvidia. Optimized for use with CS:GO.
MIT License
440 stars 76 forks source link

How to use Yolov3 #23

Open AronHegedues opened 4 years ago

AronHegedues commented 4 years ago

I'm trying to use Yolov3 instead of Yolov3-tiny. I downloaded the yolov3.cfg and the yolov3.weights from https://github.com/AlexeyAB/darknet and changed the weights and the config Path

weightsPath = os.path.sep.join([YOLO_DIRECTORY, "yolov3.weights"])
configPath = os.path.sep.join([YOLO_DIRECTORY, "yolov3.cfg"])

But I get this Traceback:

Traceback (most recent call last):
  File "C:/Users/Simp/PycharmProjects/Bots/Cheat/PineCopy/pine.py", line 14, in <module>
    pine.start(aimbot=True, show=True)
  File "C:\Users\Simp\PycharmProjects\Bots\Cheat\PineCopy\lib\pine.py", line 245, in start
    layerOutputs = net.forward(ln)
cv2.error: OpenCV(4.1.2) C:\projects\opencv-python\opencv\modules\dnn\src\layers\concat_layer.cpp:95: error: (-201:Incorrect size of input array) Inconsistent shape for ConcatLayer in function 'cv::dnn::ConcatLayerImpl::getMemoryShapes'

I would be very happy if someone could suggest a solution.

FidgetySo commented 4 years ago

I believe you need to change the input shape of the blob in lib/pine.py I don't know the dimensions required for Yolov3

ofeksadlo commented 3 years ago

In original code in the conversion of the image input into a blob to feed the model the width and height are 150x150: blob = cv2.dnn.blobFromImage(frame, 1 / 260, (150, 150),swapRB=False, crop=False) net.setInput(blob) layerOutputs = net.forward(ln)

But in most yolov3 models the input size supposed to be a multiple of 32 so try changing it to 160x160 like that blob = cv2.dnn.blobFromImage(frame, 1 / 260, (160, 160),swapRB=False, crop=False)