-
-
Notifications
You must be signed in to change notification settings - Fork 15.9k
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
Custom object detection by retaining the original classes of yolo #13025
Comments
@b4u365 hello! It sounds like you want to expand your model's capabilities to detect both new and existing classes. To achieve this, you'll need to train on a dataset that includes all desired classes — both the default ones like cars and pedestrians, and your custom classes like road signs and traffic barrels. Here’s a quick guide:
This approach ensures that the model learns to detect both old and new classes together. Good luck with your training! 😊 |
Thank you so much, This Helps me alot.
Can I freeze all the layers except last layers as shown below option A,
will freezing transfer the features of weights of yolov5s.pt which was
trained on larger datasets?
or is it advisable to train all the layers (option B)? My main goal is the
weights must be as good as the original yolov5s.pt with additional
capability due to custom training dataset.
option A: python train.py --freeze 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
16 18 19 21 22
or
option B: python train.py.
Can you help me in resolving this?
Thanks and regards,
Bharath.
…On Sat, May 18, 2024 at 8:15 PM Glenn Jocher ***@***.***> wrote:
@b4u365 <https://github.com/b4u365> hello! It sounds like you want to
expand your model's capabilities to detect both new and existing classes.
To achieve this, you'll need to train on a dataset that includes all
desired classes — both the default ones like cars and pedestrians, and your
custom classes like road signs and traffic barrels.
Here’s a quick guide:
1.
*Dataset Preparation*: Combine your custom dataset with a dataset
containing the default YOLO classes. Ensure each class is properly labeled.
2.
*Training*: When setting up your training configuration in YOLOv5,
update the *.yaml file to include all classes (default and custom).
This means adjusting the number of classes and providing the names of each
class.
3.
*Model Training*: Use the command to start training, ensuring to
specify the path to your combined dataset and updated *.yaml file.
This approach ensures that the model learns to detect both old and new
classes together. Good luck with your training! 😊
—
Reply to this email directly, view it on GitHub
<#13025 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A5IF5OEMVLC6U4YU4ZZCPN3ZC7VJRAVCNFSM6AAAAABH5TZN2WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJZGAZTQNJTGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@b4u365 hi Bharath, Glad to hear the previous advice was helpful! Regarding your question about freezing layers:
Given your goal of retaining the original quality of yolov5s.pt while adding new capabilities, I'd recommend starting with Option A to leverage the pre-trained features and then, if necessary, fine-tuning with Option B based on the performance and results you observe. Best of luck with your training! 😊 |
Thank you so much for quick response.
I trained using option “A” :
python train.py --freeze 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 18 19 21
22
But the performance for detection of cars has decreased with option “A”
approach compared to original weights of yolov5 . can you help in getting
the performance similar to original
Weights but want to include the new classes.
Thanks and regards,
Bharath
…On Sun, May 19, 2024 at 1:29 PM Glenn Jocher ***@***.***> wrote:
@b4u365 <https://github.com/b4u365> hi Bharath,
Glad to hear the previous advice was helpful! Regarding your question
about freezing layers:
-
*Option A (Freezing Layers)*: Freezing most of the layers and only
training the last few can indeed help in transferring the learned features
from the large dataset used in yolov5s.pt. This approach is faster and
consumes less computational resources. However, it might limit the model's
ability to adapt to the new classes in your custom dataset.
-
*Option B (Training All Layers)*: This option allows the model to
better adapt to the new data, potentially improving accuracy for your
custom classes at the expense of more extensive computation and training
time.
Given your goal of retaining the original quality of yolov5s.pt while
adding new capabilities, I'd recommend starting with *Option A* to
leverage the pre-trained features and then, if necessary, fine-tuning with *Option
B* based on the performance and results you observe.
Best of luck with your training! 😊
—
Reply to this email directly, view it on GitHub
<#13025 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A5IF5OEVJQCBBEZHS467MLTZDDOOVAVCNFSM6AAAAABH5TZN2WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJZGMYDONZUHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hi Bharath, It sounds like freezing the layers might be too restrictive for adapting to your new classes while maintaining performance on the original ones. I recommend gradually unfreezing some of the earlier layers to allow more flexibility in learning features relevant to both new and existing classes. You can start by unfreezing earlier layers incrementally and observing the impact on performance. Here's a modified command to unfreeze some earlier layers: python train.py --freeze 10 11 12 13 14 15 16 18 19 21 22 This approach strikes a balance between leveraging pre-trained features and adapting to new data. Let's see how this adjustment works out! 😊 |
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help. For additional resources and information, please see the links below:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed! Thank you for your contributions to YOLO 🚀 and Vision AI ⭐ |
Search before asking
Question
I have custom data set with Road signs, Traffic barrales which need to be trained and detected retaining the earlier classes of yolov5s.pt like (Cars, pedistrains, etc). once i train with custom data set , yolo could only detect the trained objects like Traffic barrels but was not detecting the cars and persons. can you help me in resolving this issue were i need to detect both road signs, traffic barrales along with Cars, pedistians which was there in yolov5 deafult weights .
Additional
No response
The text was updated successfully, but these errors were encountered: