Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steps Taken to Solve Issues and Run the Yolov4 repositary : #579

Open
SurajSanap opened this issue Dec 14, 2024 · 0 comments
Open

Steps Taken to Solve Issues and Run the Yolov4 repositary : #579

SurajSanap opened this issue Dec 14, 2024 · 0 comments

Comments

@SurajSanap
Copy link

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

  1. 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant