Comments (3)
Hello! 😊
Absolutely, you can achieve this by tweaking the dataset loading part of the code, specifically in the datasets.py
file. Before your data is passed into the training loop, you can adjust the class indices on the fly. Here's a quick snippet to give you an idea:
for label in labels:
if label[0] == 1: # Change vans to cars
label[0] = 0
elif label[0] == 3 or label[0] == 4: # Combine people and pedestrian classes
label[0] = 2
# Adjust indices for other classes accordingly
Place this snippet right after the labels for your images are loaded and before they are used for training. This way, you modify the annotations in memory without altering your dataset locally.
Remember, changes made this way are not permanent and will reset each time the data is loaded for training. Ensure this adjustment aligns with your data handling policies and practices.
Happy coding! 😊
from yolov5.
Hello @glenn-jocher
Thank you very much for your response.
I can't find the file datasets.py
from yolov5.
Hello! 😊
My apologies for any confusion. The correct file to look for modifications would be in your YOLOv5 setup; it's likely named slightly differently or the functionality could be encapsulated somewhere within the data loading and preprocessing mechanisms.
For adjusting labels in YOLOv5, you'd typically look into the dataset loading section, which as of the latest versions, involves modifying the behavior within the load
function that pertains to dataset handling, potentially in files like load.py
or similar.
If you're navigating the latest structure and still can't locate the precise spot for this adjustment, I'd recommend reviewing the documentation or exploring the source where datasets are loaded and preprocessed. Understanding how data flows through these starting points will give you a clear indication of where to implement the class index adjustments.
Keep the exploration going, and you're doing great! 😊
from yolov5.
Related Issues (20)
- Code doubts about the model in the detection process HOT 2
- predicting from 2D array HOT 2
- Same yolov5s training, but one over-fitting and one training is very good. HOT 2
- Hello, I have some questions about the YOLOv5 code. Could you please help me answer them? HOT 2
- Different results from train.py and val.py HOT 1
- How to change training input image size? HOT 8
- Cannot select specific coda device HOT 2
- Run yolov5 using tensor rt HOT 1
- Is it possible to add ShuffleNetV2 as backbone in the official repo? HOT 2
- Memory Error When Training YOLOv5 Using Git Bash HOT 4
- How to use tensor rt in yolov5 detection HOT 1
- resume_evolve BUG!!! HOT 3
- Classification training model error HOT 2
- How do Yolo target assignments to anchors work? HOT 3
- roc curve HOT 5
- Confusion Matrix wrong output HOT 2
- Zero recall and zero precision even after 100 epochs and pretrained weights HOT 2
- May I ask yolov5 how to port the method of calculating P, R, AP, MAP in val.py to adapt to detect.py, what code need to be packed? HOT 2
- CONVERT yolov5 TO onxx and openvino format HOT 4
- Inference model after convert to tflite file. HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yolov5.