Git Product home page Git Product logo

yolov4-custom-functions's People

Contributors

theaiguyscode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yolov4-custom-functions's Issues

Getting a constant ValueError

i have made the already necessary changes but every time I try
!python save_model.py --weights /content/drive/MyDrive/yolov4/tensorflow-yolov4-tflite-master/data/custom.weights --output ./checkpoints/custom-416 --input_size 416 --model yolov4

I get a value error as:
File "save_model.py", line 49, in save_tf
utils.load_weights(model, FLAGS.weights, FLAGS.model, FLAGS.tiny)
File "/content/drive/MyDrive/yolov4/tensorflow-yolov4-tflite-master/core/utils.py", line 63, in load_weights
conv_weights = conv_weights.reshape(conv_shape).transpose([2, 3, 1, 0])
ValueError: cannot reshape array of size 173840 into shape (256,128,3,3)

can anyone please suggest a solution to this?

issues with detect_video.py on colab

Hey,

Thank you for another amazing tutorial/repo.

There seems to be a few issues for running some of the functions on colab.

Converting to TFLite works for detect.py.

But, for videos, the classifications and detections are way off. For example, in people videos, no people are being detected, instead, elephants and zebras are detected with high confidence. In car videos, no cars are detected.
Restricting the classification to allowed classes (people and cars) doesn't work either, as nothing gets detected anymore.

Ran into errors of "cannot connect to server X"
To bypass error, commented the following in detect_video.py
"#cv2.namedWindow()
#cv2.destroyAllWindows()

reproduce issue:
Colab

!git clone "https://github.com/theAIGuysCode/yolov4-custom-functions.git"
!pip3 install -r /content/yolov4-custom-functions/requirements-gpu.txt

Convert darknet weights to tensorflow

The weights folder is on my google drive.

%cd /content/yolov4-custom-functions
!ls
# convert the model from yolov4 to tensorflow then TFLite
# Save tf model for tflite converting
!python3 /content/yolov4-custom-functions/save_model.py --weights /content/drive/MyDrive/object_counting_yolov4/pre-trained_weights/yolov4.weights --output ./checkpoints/yolov4-416 --input_size 416 --model yolov4 --framework tflite

# yolov4
!python3 /content/yolov4-custom-functions/convert_tflite.py --weights ./checkpoints/yolov4-416 --output ./checkpoints/yolov4-416.tflite

# yolov4 quantize float16
#!python3 /content/yolov4-custom-functions/convert_tflite.py --weights ./checkpoints/yolov4-416 --output ./checkpoints/yolov4-416-fp16.tflite --quantize_mode float16

# yolov4 quantize int8 - for whatever reason the /coco_dataset/coco/val207.txt is missing. RPi is a float based anyways.
#!python3 /content/yolov4-custom-functions/convert_tflite.py --weights ./checkpoints/yolov4-416 --output ./checkpoints/yolov4-416-int8.tflite --quantize_mode int8 --dataset ./coco_dataset/coco/val207.txt

# to change the count from total number of objects to number of objects per class:
# change 
#if FLAGS.count:
# by_class = True

# Run tflite model
!python3 detect.py --weights ./checkpoints/yolov4-416.tflite --size 416 --model yolov4 --images ./data/images/dog.jpg --framework tflite --count

Number of bicycles: 1
Number of dogs: 1
Number of trucks: 1

Testing on another image

# Run tflite model
!python3 detect.py --weights ./checkpoints/yolov4-416.tflite --size 416 --model yolov4 --images ./data/images/kite.jpg --framework tflite --count

Number of persons: 7
Number of kites: 6

# Run yolov4 on video
# similarly, change total count type from total number to total count per class
# by changing
#if FLAGS.count:
# by_class = True  
!python3 detect_video.py --weights ./checkpoints/yolov4-416 --model yolov4 --video ./data/video/cars.mp4 --output ./detections/results.avi --dont_show --framework tf --info

# more details for each detection, inlcuding confidence, BBox coordinates: --info    instead of    --count  

# Run yolov4 on webcam
# !python3 detect_video.py --weights ./checkpoints/yolov4-416 --size 416 --model yolov4 --video 0 --output ./detections/results.avi

Infer in detect.py outputs zero size matrix for all images except first

I have trained yolov4-640 on the plate detection, exactly like what is said in tutorial. I used save_model.py exactly like what is said for the pre-trained one. I pass some images to detect.py, the first image is ok and the plate is detected but for the next images output of infer is zero size. If I change the sort of images and pass them again, again the first image is ok but the next one are zero size

little advice

Your warehouse is very valuable and very exciting work. And I think you can add more work on model compression such as quantification, pruning and distillation.

Does not return proper number plate, returns only few letters !

Hi,

The repo is working great, thank you for sharing the work !

However, in most of the cases the plate number returned is not complete, and sometimes fails to recognize the plate number.

Here I have a car image
car9

Below is the result after Dilation and other preprocesses
image

Here is the recognized result (It detects only 5)
image

Sometimes recognition fails when the car is at certain angle !

Can you please help with suggestions regarding certain tunings involved.

Thanks in Advance !

How can i predict on more than 1 image on a custom yolov4 model?

When i try to pass a numpy array of a list of images, i have this error. In this case the batch size was 2.
Error Log:
'''
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 23 values, but the requested shape requires a multiple of 2
[[{{node StatefulPartitionedCall/functional_1/tf_op_layer_Reshape_14/Reshape_14}}]] [Op:__inference_signature_wrapper_5588]

Function call stack:
signature_wrapper
'''

yolov3-openimages.weights

Hi,
i have tried to convert and use the yolov3-openimages.weights from darknet
i added the openimages.names to data\classes and adjusted the config.py, and then converted everything the same way as before with the yolov3.weights ...
everything seems to work, but nothing is detected. (even after adding --score 0.01)
Any idea what I might have missed?

Yolo v4 Python has stopped working in CPU mode

when i enter "conda activate yolov4",then after that when i run this command "python save_model.py --weights ./data/custom.weights --output ./checkpoints/custom-416 --input_size 416 --model yolov4 " it shows a pop up like - Python has stopped working.....please help me out

Streaming videos from an IP.

I wanted to use my phone camera for streaming the video for detections. So I got an app called IP webcam where it sent live camera display to my pc via an IP like https://192.168.0.0.1/camera, it's just a demo.
So how can I use this video in the model?

Outputting software view to virtual webcam and a few questions

so I am planning on making a program that is controlled by c#, or python I don't know yet but I would like this program to have a view of what you see when you load up webcam detection. If possible could you output the software view to a virtual camera

also how do you make it so it only detects certain classes

also amazing video I love your content! you are one of the most helpful resources I have found for my projects!!

The variable timed the object to appear in the frame, any advice is useful to me!

Thank you for your enthusiasm and dedicated guidance, I am a newbie and have learned a lot from you.
Thank you so much!

And now I'm trying to customize some of the flags, which timed the object's appearance in the video. For example, the parking time of each car in the parking lot.

I look forward to receiving your great help. Once again, thanks very much!

run detection on multiple images at once

Hi, I very much appreciate the work you've done here.
I was wondering if there's a way to edit the code so that I can run detection on multiple images and save results in a text file. The results being the coordinates and the image name. (Trying to create more training data for a larger dataset)

YOLOv4 custom function doesnt detect video while running on GPU

Hi everyone, im using YOLOv4 custom function from this repo. Everything works flawlessly, including convert weights file to pb file, run detection on both image and videos, then this error shows up on both pc and colab:

  • When i use only CPU, detection runs fine on both image and video data
  • When i use GPU, detections only runs on image. When run on videos, it still runs, but doesnt detect anything. I assume that the detection only runs on the first frame, but not on the rest ones.
  • Here is the console log when run video detect on CPU :
    Screen Shot 2021-05-01 at 17 32 04
  • Here is the console log when run video detection on GPU ( im sorry if log is a little bit too long )

2021-05-01 10:32:33.098862: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2021-05-01 10:32:34.935938: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-05-01 10:32:34.936785: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcuda.so.1
2021-05-01 10:32:34.953709: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-05-01 10:32:34.954371: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:00:04.0 name: Tesla P100-PCIE-16GB computeCapability: 6.0
coreClock: 1.3285GHz coreCount: 56 deviceMemorySize: 15.90GiB deviceMemoryBandwidth: 681.88GiB/s
2021-05-01 10:32:34.954406: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2021-05-01 10:32:34.957049: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.11
2021-05-01 10:32:34.957129: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublasLt.so.11
2021-05-01 10:32:34.958917: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcufft.so.10
2021-05-01 10:32:34.959305: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcurand.so.10
2021-05-01 10:32:34.961111: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusolver.so.10
2021-05-01 10:32:34.961867: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusparse.so.11
2021-05-01 10:32:34.962058: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2021-05-01 10:32:34.962151: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-05-01 10:32:34.962729: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-05-01 10:32:34.963310: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-05-01 10:32:35.006935: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-05-01 10:32:35.007063: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-05-01 10:32:35.007689: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:00:04.0 name: Tesla P100-PCIE-16GB computeCapability: 6.0
coreClock: 1.3285GHz coreCount: 56 deviceMemorySize: 15.90GiB deviceMemoryBandwidth: 681.88GiB/s
2021-05-01 10:32:35.007719: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2021-05-01 10:32:35.007756: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.11
2021-05-01 10:32:35.007781: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublasLt.so.11
2021-05-01 10:32:35.007803: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcufft.so.10
2021-05-01 10:32:35.007839: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcurand.so.10
2021-05-01 10:32:35.007859: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusolver.so.10
2021-05-01 10:32:35.007881: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusparse.so.11
2021-05-01 10:32:35.007903: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2021-05-01 10:32:35.007991: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-05-01 10:32:35.008575: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-05-01 10:32:35.009095: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-05-01 10:32:35.009140: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2021-05-01 10:32:35.503454: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-05-01 10:32:35.503505: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267] 0
2021-05-01 10:32:35.503515: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0: N
2021-05-01 10:32:35.503690: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-05-01 10:32:35.504369: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-05-01 10:32:35.504897: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-05-01 10:32:35.505452: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1406] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14975 MB memory) -> physical GPU (device: 0, name: Tesla P100-PCIE-16GB, pci bus id: 0000:00:04.0, compute capability: 6.0)
True: False
2021-05-01 10:32:35.506749: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-05-01 10:32:35.506845: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-05-01 10:32:35.507388: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:00:04.0 name: Tesla P100-PCIE-16GB computeCapability: 6.0
coreClock: 1.3285GHz coreCount: 56 deviceMemorySize: 15.90GiB deviceMemoryBandwidth: 681.88GiB/s
2021-05-01 10:32:35.507418: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2021-05-01 10:32:35.507459: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.11
2021-05-01 10:32:35.507472: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublasLt.so.11
2021-05-01 10:32:35.507485: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcufft.so.10
2021-05-01 10:32:35.507497: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcurand.so.10
2021-05-01 10:32:35.507512: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusolver.so.10
2021-05-01 10:32:35.507524: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusparse.so.11
2021-05-01 10:32:35.507536: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2021-05-01 10:32:35.507582: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-05-01 10:32:35.508113: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-05-01 10:32:35.508604: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-05-01 10:32:35.508630: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-05-01 10:32:35.508640: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267] 0
2021-05-01 10:32:35.508647: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0: N
2021-05-01 10:32:35.508710: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-05-01 10:32:35.509240: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-05-01 10:32:35.509738: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1406] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14975 MB memory) -> physical GPU (device: 0, name: Tesla P100-PCIE-16GB, pci bus id: 0000:00:04.0, compute capability: 6.0)
Current threshold: 0.5
2021-05-01 10:32:50.238825: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:116] None of the MLIR optimization passes are enabled (registered 2)
2021-05-01 10:32:50.290412: I tensorflow/core/platform/profile_utils/cpu_utils.cc:112] CPU Frequency: 2199995000 Hz
2021-05-01 10:32:50.932916: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2021-05-01 10:32:51.960900: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.11
2021-05-01 10:32:52.189146: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublasLt.so.11
FPS: 0.41
FPS: 23.86
FPS: 23.61
FPS: 24.18
FPS: 23.84
FPS: 23.82
FPS: 24.36
FPS: 23.82
FPS: 24.10
FPS: 24.39
FPS: 24.17
FPS: 24.09
FPS: 24.54
FPS: 23.93
FPS: 23.35
FPS: 24.02
FPS: 24.11
FPS: 24.48
FPS: 24.10
FPS: 24.29
FPS: 24.46
FPS: 24.48
FPS: 23.62
FPS: 23.79
FPS: 23.76
FPS: 24.01
FPS: 24.43
FPS: 23.52
FPS: 24.46
FPS: 24.13
FPS: 24.11
FPS: 23.79
FPS: 24.62
FPS: 24.32
FPS: 24.06
FPS: 24.51
FPS: 24.46
FPS: 24.40
FPS: 24.48
FPS: 24.62
Video end

At first i assume that my GPU is not strong enough ( GTX 1050 mobile), but it happens even when running on colab pro with Tesla V100
I appreciate any helps.

save_model.py gives errors while converting YOLOV4 to tensorflow weights

Previously it was working, i don't know why now it is giving errors. Please i need help
errors are listed below-------->

Current thread 0x00003348 (most recent call first):
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\ops\gen_random_ops.py", line 639 in random_standard_normal
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\ops\random_ops.py", line 94 in random_normal
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\util\dispatch.py", line 201 in wrapper
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\ops\init_ops_v2.py", line 1035 in random_normal
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\ops\init_ops_v2.py", line 385 in call
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\ops\resource_variable_ops.py", line 1651 in _init_from_args
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\ops\resource_variable_ops.py", line 1518 in init
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\ops\variables.py", line 264 in call
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 2597 in default_variable_creator
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\ops\variables.py", line 199 in
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\ops\variables.py", line 221 in _variable_v1_call
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\ops\variables.py", line 260 in call
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\keras\engine\base_layer_utils.py", line 145 in make_variable
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\training\tracking\base.py", line 743 in _add_variable_with_custom_getter
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 614 in add_weight
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\keras\layers\convolutional.py", line 204 in build
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 2643 in _maybe_build
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 1098 in _functional_construction_call
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 926 in call
File "C:\tensorflow1\custom function\yolov4-custom-functions-master\core\common.py", line 31 in convolutional
File "C:\tensorflow1\custom function\yolov4-custom-functions-master\core\backbone.py", line 41 in cspdarknet53
File "C:\tensorflow1\custom function\yolov4-custom-functions-master\core\yolov4.py", line 72 in YOLOv4
File "C:\tensorflow1\custom function\yolov4-custom-functions-master\core\yolov4.py", line 25 in YOLO
File "save_model.py", line 20 in save_tf
File "save_model.py", line 54 in main
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\absl\app.py", line 251 in _run_main
File "C:\ProgramData\Anaconda3\envs\yolov4-gpu\lib\site-packages\absl\app.py", line 303 in run
File "save_model.py", line 58 in

Error with custom model and custom resolution

Hello Thanks for amazing work.

I try to use another resolution on custom model which was trained on low resolution and test on high resolution. But if I try after converting in tf-model to detect something I get the following error:

image

Could you explain how can I solve this issue?
And how can I use more than one GPU. Your solution with
image doesn't work.

Thank you!

yolov4-custom-functions --- API

You're the best and your videos are vey helpful, i would like to create APIs using FastAPI or FlaskAPI for this custom-functions to return image detection and information of detect as json, i appreciate to add it on this repository or such example can help us.

thanks in advance

Social distance checker

I think it would be cool to add a social distance checker and display bounding boxes of those persons in a different color. Or some other integration that can visualize if a certain event happens in the video.

ocr not working

pytesseract is not working well on my number plates which is indonesian number plates could you suggest me other ocr methods that works on these type of number plates.

Functionality of integrating license_plate_recognizer automatically after crop

Hey Mate,

like a lot of other people here and at our YT channel I can just tell the same and am really grateful for your effort and coding skills.

I just wanted to know, if you already wrote the connection/ functionality mentioned above?

It's the one you quoted it here:
"However, I believe the best route to go is to run video detections without the plate flag and instead run them with --crop flag which crops the objects found on screen and saves them as new images. See how it works here Once the video is done processing at a higher FPS all the license plate images will be cropped and saved within detections/crop folder. I have added an easy script within the repository called license_plate_recognizer.py that you can run in order to recognize license plates. Plus this allows you to easily customize the script to further enhance any recognitions. I will be working on linking this functionality automatically in future commits to the repository."

If yes, i'd be grateful for it, otherwise I try to code it by my own :)

thanks again and stay healthy mate!

Message when YOLO capturing an object

How should I do so that when it detects an object with some confidence it can send a message saying that YOLO detects an object of class X, for example using a print() function?

Thanks!

tensorflow-directml saved model

tensorflow v1 default save format is H5, to save in tf

suggest to state for v1, include the following save_model .py line 51 for darknet yolov4 conversion
model.save(FLAGS.output,overwrite='true',save_format='tf')
in detect_video.py , v1 should be change in line 56 as
saved_model_loaded = tf.compat.v2.saved_model.load(FLAGS.weights, tags=[tag_constants.SERVING])

Plate Characters Recognition

Hi , I would like to know if there is any chance about know how to draw the boxes around the letters or numbers in the plate , just like in the description.
It's just for an educate propuse. I've tried but for the moment I have not been able to do it :c

custom.weights and custom-416

Hello, please help
So
python save_model.py --weights ./data/custom.weights --output ./checkpoints/custom-416 --input_size 416 --model yolov4

I get error
File "C:\Users\va\Documents\Arduino\yolov4-custom-functions-master\core\utils.py", line 143, in load_weights conv_weights = conv_weights.reshape(conv_shape).transpose([2, 3, 1, 0]) ValueError: cannot reshape array of size 4554552 into shape (1024,512,3,3)
Where custom.names file?

Please help

About counter function issues

Hi there,
First of all, thx for your work. It is a nice program.
I have a question about the counter in the project.
If I want to display the total number of detections and the number of classification detections, instead of showing the classification number and the total number of detections in the current frame. How do I change the function.py?
The first time, I dele the 'else' in the count. But only the items detected in the current frame can be displayed, and the sum function cannot be realized.
Can u give me any advice?
thanks

won't work saving custom weights to saved_model.pb

tried with cpu & gpu tensorflow

python3 save_model.py --weights ./data/custom.weights --output ./checkpoints/custom-416 --input_size 416 --model yolov4 
2020-11-15 10:47:19.227868: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
2020-11-15 10:47:20.467105: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcuda.so.1
2020-11-15 10:47:21.073388: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-11-15 10:47:21.074016: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties: 
pciBusID: 0000:00:04.0 name: Tesla V100-SXM2-16GB computeCapability: 7.0
coreClock: 1.53GHz coreCount: 80 deviceMemorySize: 15.75GiB deviceMemoryBandwidth: 836.37GiB/s
2020-11-15 10:47:21.074059: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
2020-11-15 10:47:21.076255: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcublas.so.10
2020-11-15 10:47:21.078071: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcufft.so.10
2020-11-15 10:47:21.078490: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcurand.so.10
2020-11-15 10:47:21.080445: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusolver.so.10
2020-11-15 10:47:21.082111: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusparse.so.10
2020-11-15 10:47:21.082262: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudnn.so.7'; dlerror: libcudnn.so.7: cannot open shared object file: No such file or directory
2020-11-15 10:47:21.082281: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1753] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2020-11-15 10:47:21.082669: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2020-11-15 10:47:21.091500: I tensorflow/core/platform/profile_utils/cpu_utils.cc:104] CPU Frequency: 2300000000 Hz
2020-11-15 10:47:21.092099: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x6544520 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-11-15 10:47:21.092130: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-11-15 10:47:21.094041: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1257] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-11-15 10:47:21.094074: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1263]      
Traceback (most recent call last):
 File "save_model.py", line 58, in <module>
   app.run(main)
 File "/home/ubuntu/.local/lib/python3.5/site-packages/absl/app.py", line 303, in run
   _run_main(main, args)
 File "/home/ubuntu/.local/lib/python3.5/site-packages/absl/app.py", line 251, in _run_main
   sys.exit(main(argv))
 File "save_model.py", line 54, in main
   save_tf()
 File "save_model.py", line 49, in save_tf
   utils.load_weights(model, FLAGS.weights, FLAGS.model, FLAGS.tiny)
 File "/home/ubuntu/yolov4-custom-functions/core/utils.py", line 143, in load_weights
   conv_weights = conv_weights.reshape(conv_shape).transpose([2, 3, 1, 0])
ValueError: cannot reshape array of size 4554552 into shape (1024,512,3,3)

--info-function with time measurement

Hi there,

first of all, thx for ur work.
Thru you i started with python. And now i try to learn more about DL and object detection.

Now i wanna test out how much slower the object detection on my GPU is in comparision to the GPU from Google Colab.
In your Colab tutorials u implemented a time measurment for the object detection.

Can u give me a advice how i can implement such a thin in this --info function?

How can I can add another label in box?

how can I add another label in box for example, the left side is the label is truck ,dog, and bicycle but for the right side i want to be like a timer object detected or bike 1, dog 1, bicycle 1, if more than 1 then it would be bike 2, dog 2, bicycle 2

obj

Getting data from ScreenCatpureTools

First, many thanks for the amazing work you've done. It is really detailed and works for basically anything.
Could you please add some indications in this github on how the VideoCaptureFlags works in detect_video.py?
It is so that we can use some kind of screen(monitor) capture tools instead of "0" for webcams, especially mss.mss()* so that we can efficiently use the yolov4-tiny and tensorflow-lite Tutorials you've created.

  • mss "An ultra fast cross-platform multiple screenshots module in pure python using ctypes."
    https://github.com/BoboTiG/python-mss about as many fps as the monitor itself can show (60)
    tiny can fast enough that sometimes the videocapture of the screen is the bottleneck weirdly enough...

By the way,
Here are the commands i used to train a tiny version for a custom yolo to detect birds from multiple cameras streamed to a pc. Maybe you could add them to the shared link of the video "yolov4 in the clouds" with a # as an option for people to train a yolo tiny just as seamlessly as they can train a full blown yolo following your tutorial and pre-made commands.
something along the lines as you did in step 5:
"(uncomment %%capture below if you run into memory issues or your Colab is crashing)"

Here are the commands modified for tiny:

STEP 3
i)
#_ !cp /mydrive/yolov4/yolov4-tiny-obj.cfg ./cfg

STEP 4
#_ !wget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-tiny.conv.29

STEP 5
#_ !./darknet detector train data/obj.data cfg/yolov4-tiny-obj.cfg yolov4-tiny.conv.29 -dont_show -map

and here is the link for the raw version of the config file for yolotiny:
https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov4-tiny.cfg

Malaysian Number plate

Hye, i tried the code it's work, but when using Malaysian number plate, the program detect the plate but cant return the plate number. Anybody had any idea with that ?

8

9

Need help!!

Can you guide me below:

  1. Add a unique id for each person detected and boxed.
  2. Generate Json file to capture per frame detection result
  3. Add trajectory for each object tracked.

YOLOv5

can we do the same thing for YOLO v5 model ?

Does not return the plate number

Hi
I am having a problem with the return of the plate.
I can detect it but it doesn't return the plate number.
I'm using the command: python detect.py --weights ./checkpoints/custom-416 --size 416 --model yolov4 --images ./data/images/car.jpg --plate

image

Can you help me?

Can we create an function for Detecting objects within a specified detection boundary.

Hey man first of all awesome video and love the effort that you put in , keep it up. So my question is can we create a function that sets a detection on boundary on the video feed and when the object is in the detection boundary it gets detected or else not.
When the object is within the boundary count goes up and as it leaves the boundary count goes down.

Is pretty much the same thing you done in the video but this time we just need a particular section of the footage to detect and count.
here is a video for the example of what we want to achieve,

https://www.youtube.com/watch?v=u_XOczajfRI

License Plate detected but the TEXT is half shown

detection1
Using this tutorial i used the provided pretrained mechanism and tried to detect the number plate using my image and it turns out that the text is half detected.

Wanted to know if any specific reason for this? Is the model respected to some region wise license plates, even if that is the case, a normal license text should be detected.

In need of urgent help please! Tell me how to fix this error

Traceback (most recent call last):
File "save_model.py", line 58, in
app.run(main)
File "C:\Users\AppData\Local\Programs\Python\Python37\lib\site-packages\absl\app.py", line 303, in run
_run_main(main, argv)
File "C:\Users\AppData\Local\Programs\Python\Python37\lib\site-packages\absl\app.py", line 251, in _run_main
sys.exit(main(argv))
File "save_model.py", line 54, in main
save_tf()
File "save_model.py", line 49, in save_tf
utils.load_weights(model, FLAGS.weights, FLAGS.model, FLAGS.tiny)
File "C:\Repos\yolov4-custom-functions\core\utils.py", line 143, in load_weights
conv_weights = conv_weights.reshape(conv_shape).transpose([2, 3, 1, 0])
ValueError: cannot reshape array of size 4554552 into shape (1024,512,3,3)

Integration with django app

I want to call the detect module in my django app could you tell me possible step I could do to call the function or module directly by passing image to detect.py

Does not return the plate number

Hi
I am having a problem with the return of the plate.
I can detect it but it doesn't return the plate number.
I'm using the command: python detect.py --weights ./checkpoints/custom-416 --size 416 --model yolov4 --images ./data/images/car.jpg --plate

image

Can you help me?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.