You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Environment Setup
Action: Created a virtual environment and installed dependencies using:
pip install -r requirements.txt
Error: numpy==1.18.2 failed to install due to build issues (ModuleNotFoundError: No module named 'distutils.msvccompiler').
Solution: Removed version restrictions in requirements.txt to allow the latest compatible versions of dependencies to install.
2. Weights Missing Error: FileNotFoundError: No such file or directory: 'weights/yolov4.weights'.
Solution:
Downloaded yolov4.weights from the official source.
Saved the file in the weights/ directory.
3. CUDA-Related Issue Error: AssertionError: Torch not compiled with CUDA enabled.
Solution:
Updated the script to run on the CPU by replacing all .cuda() calls with .cpu().
4. OpenCV Coordinate Type Issue Error: cv2.error: Can't parse 'pt2'. Sequence item with index 0 has a wrong type.
Cause: cv2.rectangle and cv2.putText require integer coordinates, but the script used np.float32.
Solution:
Updated the plot_boxes_cv2 function in the script:
Replaced all occurrences of np.float32 with int for rectangle and text coordinates.
Viewing the Output
Output File: The annotated image with predictions was saved as created the new directory which name is prediction_outputs and storing the following format : {image_1}_predictions.json in the project directory.
The text was updated successfully, but these errors were encountered:
1. Environment Setup
Action: Created a virtual environment and installed dependencies using:
pip install -r requirements.txt
Error:
numpy==1.18.2 failed to install due to build issues (ModuleNotFoundError: No module named 'distutils.msvccompiler').Solution: Removed version restrictions in requirements.txt to allow the latest compatible versions of dependencies to install.
2. Weights Missing
Error:
FileNotFoundError: No such file or directory: 'weights/yolov4.weights'.Solution:
Downloaded yolov4.weights from the official source.
Saved the file in the weights/ directory.
3. CUDA-Related Issue
Error:
AssertionError: Torch not compiled with CUDA enabled.Solution:
Updated the script to run on the CPU by replacing all .cuda() calls with .cpu().
4. OpenCV Coordinate Type Issue
Error:
cv2.error: Can't parse 'pt2'. Sequence item with index 0 has a wrong type.Cause: cv2.rectangle and cv2.putText require integer coordinates, but the script used np.float32.
Solution:
Updated the plot_boxes_cv2 function in the script:
Replaced all occurrences of np.float32 with int for rectangle and text coordinates.
5. Running the Script
Command Used:
python demo.py -cfgfile cfg/yolov4.cfg -weightfile weights/yolov4.weights -imgfile dataset/image_1.jpg
Output File: The annotated image with predictions was saved as created the new directory which name is prediction_outputs and storing the following format : {image_1}_predictions.json in the project directory.
The text was updated successfully, but these errors were encountered: