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)
- Extract information of Coordinates HOT 2
- ModuleNotFoundError: No module named 'models.yolo' on custom trained weight. Is it a bug? HOT 6
- Why 'targets' values from train.py are different from the ground truth annotation in txt files? HOT 3
- A question between yolov5s-p5 and the parameters imgsz HOT 2
- YOLOv5 Output Size Issue HOT 2
- What Should Be the Output Size of Predictions for Object Detection? HOT 3
- stuck training on NVIDIA H100 HOT 2
- Problem running inference on YOLOv5s for custom trained model using Python HOT 2
- The confidence loss (obj_loss) scales of the training and validation sets are inconsistent. HOT 1
- Can I load YOLOv5 model without Ultralytics HOT 3
- The memory usage of the 0 card will increase until it is out of memory HOT 2
- scale_masks fucntion HOT 1
- cls loss HOT 1
- Problem with training for a single class HOT 4
- Issue when try to validate openvino format model HOT 3
- Is there a problem with the way I fine-tuned the YOLOv5? HOT 3
- No module named 'models' HOT 2
- Roc curve /part 2 HOT 1
- REQUIREMENTS.TXT FILE ERROR WITHIN YOLOV5 HOT 2
- Custom object detection by retaining the original classes of yolo HOT 5
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.