i am getting error error: OpenCV(4.10.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\darknet\darknet_io.cpp:705: error: (-215:Assertion failed) separator_index < line.size() in function 'cv::dnn::darknet::ReadDarknetFromCfgStream'
Hi very useful video. Thank you. Can you please make on 'how to zoom using OBS for musicians' (for livestreaming during zoom). I notice the music notes and treble chef on your wall. Are they stickers or 3D acrylic stick on?
in my terminal those module of gtts and playsound are not being installed. it is showing module error: note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.
Sir, can you please make a video on object tracking in opencv with some laser pointing to an object. I will be waiting for it. i watched your other opencv and siri video. it was fun to learn it from you. Thanks.
I am getting the following error even after successfully installing and importing required libraries :- cv2.error: OpenCV(4.9.0) /io/opencv/modules/dnn/src/darknet/darknet_io.cpp:705: error: (-215:Assertion failed) separator_index < line.size() in function 'ReadDarknetFromCfgStream' . I guess this is related to "dnn"" in OpenCV. How can I resolve this issue ? (OS is Windows 10)
It is showing "nomodulefound" error and it's saying "No module named tensorflow" Its saying the error is in importing drawbbox from cvlib.object_detection
bro, i am speaking the text but not getting the youtube page opened. the output terminal is showing this"you said: xyz.............youtube.'. thats it. youtube is not getting opened. please help me bro
So saying “okay Google” works on Google phones because their code IS always running. Saying “hey Siri” works on iPhones because their code is always running. For those who do have iPhones, when your battery is low you can go into “Low Power Mode”, then saying “hey Siri” doesn’t work anymore, you have to manually hold down the home or power button. That’s because they turn off the “hey siri” program to save power.
@@SalteeKiller okay sir, i mean here i am making a voice controlled RC car project, and i want to implement your code. i need a voice activation before giving commands to the robot like turn right or left, what should i add in your code so that the code runs continuously and gets voice activation
Yeah sure, of course I can’t do it all for you for all your specifications but To implement continuous voice activation before giving commands to the robot, you can modify the `get_audio()` function to continuously listen for the activation phrase before accepting other commands. Here's how you can do it: ```python def get_audio(): while True: recorder = sr.Recognizer() with sr.Microphone() as source: audio = recorder.listen(source) try: speech_text = recorder.recognize_google(audio) print(speech_text) if "R2-D2" in speech_text: speech("\tHow may I help you?") playsound("./sounds/activate.wav") # Now listen for the actual command after activation while True: audio = recorder.listen(source) command = recorder.recognize_google(audio) if command.strip() != "": return command.strip() else: break except sr.UnknownValueError: print("Google Speech Recognition could not understand audio") except sr.RequestError as e: print("Could not request results from Google Speech Recognition service; {0}".format(e)) ``` This modified function first listens for the activation phrase ("R2-D2"). Once it detects the activation phrase, it prompts the user with a response and then listens for the actual command continuously until one is detected. Once a command is detected, it returns that command for further processing in your code.
For anyone doing this today/in the future: You can add these 2 lines of code to the bottom of your program if you don’t want the video capture to linger. He didn’t do it in the video. video.release() Cv2.destroyAllWindows
The `cv.detect_common_objects()` function from `cvlib` is designed to work on both Windows and macOS. The error you're encountering might be due to a different issue, such as an incorrect installation or an issue with the camera feed. To troubleshoot the error, you can try the following: 1. **Check Installation:** Ensure that `cvlib` is installed correctly in your Python environment. You can reinstall it using pip: ``` pip install cvlib ``` 2. **Check Camera Feed:** Make sure that your camera is connected properly and that it's providing frames to the script. You can print out the `frame` variable before calling `cv.detect_common_objects()` to check if it's `None`. 3. **Update Code:** Try updating your code to handle potential errors more gracefully. For example, you can add error handling around the `cv.detect_common_objects()` call to catch any exceptions: ```python try: bbox, label, conf = cv.detect_common_objects(frame) except Exception as e: print("Error detecting objects:", e) continue # Skip to the next iteration of the loop ``` This will print out any errors that occur during object detection and continue to the next iteration of the loop without crashing the script.
Sure thing! The error `AttributeError: 'NoneType' object has no attribute 'shape'` is likely occurring because the `frame` variable is `None` at some point in your code. This might happen when the video feed is not being read correctly or when the object detection function (`cv.detect_common_objects`) fails to detect any objects. Here are some steps to handle this issue: 1. **Check Video Capture:** Make sure the video feed is being read correctly from your camera (`VideoCapture(1)`). You can add a check to ensure that the `frame` is not `None` before proceeding with object detection. 2. **Handle NoneType:** Update your code to handle the case where `frame` might be `None`. This can happen if the camera is not providing frames properly or if there's an issue with the connection. Here's an updated version of the code with error handling for `NoneType`: ```python import cv2 import cvlib as cv from cvlib.object_detection import draw_bbox from gtts import gTTS from playsound import playsound from food_facts import food_facts def speech(text): print(text) language = "en" output = gTTS(text=text, lang=language, slow=False) output.save("./sounds/output.mp3") playsound("./sounds/output.mp3") video = cv2.VideoCapture(1) labels = [] while True: ret, frame = video.read() if frame is not None: # Bounding box. # the cvlib library has learned some basic objects using object learning # usually it takes around 800 images for it to learn what a phone is. bbox, label, conf = cv.detect_common_objects(frame) output_image = draw_bbox(frame, bbox, label, conf) cv2.imshow("Detection", output_image) for item in label: if item in labels: pass else: labels.append(item) if cv2.waitKey(1) & 0xFF == ord("q"): break # If no objects are detected, handle the case gracefully if len(labels) == 0: print("No objects detected.") else: i = 0 new_sentence = [] for label in labels: if i == 0: new_sentence.append(f"I found a {label}, and, ") else: new_sentence.append(f"a {label},") i += 1 speech(" ".join(new_sentence)) speech("Here are the food facts I found for these items:") for label in labels: try: print(f" \t{label.title()}") food_facts(label) except: print("No food facts for this item") # Release the video capture and close any open windows video.release() cv2.destroyAllWindows() ``` This code will ensure that if `frame` is `None`, it will skip the object detection step and print "No objects detected." This should help prevent the `NoneType` error from occurring.
If you're encountering an error stating "no module named tensorflow" even though you're not directly using TensorFlow in your code, it might be due to `cvlib` or other libraries indirectly requiring TensorFlow as a dependency. When you install `cvlib`, it installs `tensorflow` as one of its dependencies. So, even if you're not explicitly importing TensorFlow in your code, `cvlib` utilizes it internally for certain operations. To resolve this error, you'll need to ensure that `tensorflow` is installed in your Python environment. You can install it using pip: ``` pip install tensorflow Or if in pip3 then use: pip3 install tensorflow ``` Make sure to install TensorFlow in the same Python environment where you're running your script. After installing TensorFlow, the error should be resolved, and you should be able to run your code without encountering the "no module named tensorflow" error.
@@SalteeKiller cv2.error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\darknet\darknet_io.cpp:705: error: (-215:Assertion failed) separator_index < line.size() in function 'cv::dnn::darknet::ReadDarknetFromCfgStream' can you define this eror it comes while running the code
× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [2 lines of output] running egg_info error: PyObjC requires macOS to build [end of output]
That sounds frustrating! If you’re on pc and running into that issue, it sounds like it doesn’t like playsound. So try accessing your local environments dependencies to run the sound instead:) here’s a simple way of playing an mp3 file like we did: import os def play_sound(filename): os.system(f'start {filename}') play_sound('sound.mp3') # Replace 'sound.mp3' with your sound file
Yes so it usually means it can’t see where you have installed gtts as well as play sound. So double check those. Make sure you do all the correct spellings, including upper casing and such as I did in the video:) I don’t think gtts nor play sound has made any huge updates to cause this to not work anymore as it’s still working for others and myself at this point. So go back and double check WHERE, HOW and with which case sensitivity is needed to install it. Let us know!
I am getting this error cv2.error: OpenCV(4.9.0) /io/opencv/modules/dnn/src/darknet/darknet_io.cpp:705: error: (-215:Assertion failed) separator_index < line.size() in function 'ReadDarknetFromCfgStream' please help
Thank you sir If i want to add feature like giving response to a question " hey do you find an apple " by this model the response should be "yes apple found on the table or person hand". How to achieve this result sir