Code Monkey home page Code Monkey logo

Comments (16)

dsbyprateekg avatar dsbyprateekg commented on May 27, 2024

You must train with 5000+500=5500 images simultaneously.

from yolov7.

shubzk avatar shubzk commented on May 27, 2024

So that means, once I get a weight file after training with the initial 5000 images (1024 x 1024), there is no way to improve upon the weight file with new data?

from yolov7.

dsbyprateekg avatar dsbyprateekg commented on May 27, 2024

Yes, there is not other way. You have to train with combined data which will generate 1 weight file. May I know why were you doing so?

from yolov7.

shubzk avatar shubzk commented on May 27, 2024

I had collected about 5000 labelled images initially to train the model on a custom dataset. However, I am getting new images everyday which need to be used for training the model. How can I go about doing this? Because if I have to retrain the model with all the images every time I get new images, I am not getting the use of transfer learning.

To give you a better picture of what I am trying to accomplish, I trained the model on 5000 images (1024x 1024) using:
python train.py --workers 8 --device 0 --batch-size 8 --data data/data.yaml --img 1024 1024 --cfg cfg/training/yolov7.yaml --weights '' --name yolov7 --hyp data/hyp.scratch.p5.yaml

After this, I have gotten a 'best.pt' weight file, which I used for the following training on 500 images using the transfer learning code line:
python train.py --workers 8 --device 0 --batch-size 4 --data data/custom.yaml --img 3072 3072 --cfg cfg/training/yolov7-custom.yaml --weights 'best.pt' --name yolov7-custom --hyp data/hyp.scratch.custom.yaml

I am using an NVIDIA A100 80 GB GPU virtual machine.

from yolov7.

dsbyprateekg avatar dsbyprateekg commented on May 27, 2024

As I said, you have to add new data to your existing dataset and retrain the model from scratch.
I am assuming you have to retrain with new images since your existing trained model is unable to detect in new images, right?

from yolov7.

shubzk avatar shubzk commented on May 27, 2024

So i have a set of 20 images I am using for benchmarking different versions of the model. Lets call the weight file from training 5000 images as 5000.pt, and then I am using transfer learning to train over the initially trained model using the 5000.pt as the weight file for the new 500 images.

However, when testing, the detection from 5000.pt is better than the new weight file I am getting after training on additional 500 images.

While writing this, something occured to me, do I have to increase the number of classes in the cfg file and use that in the following line?
python train.py --workers 8 --device 0 --batch-size 4 --data data/custom.yaml --img 3072 3072 --cfg cfg/training/yolov7-custom.yaml --weights 'best.pt' --name yolov7-custom --hyp data/hyp.scratch.custom.yaml

from yolov7.

dsbyprateekg avatar dsbyprateekg commented on May 27, 2024

are you saying, the number of classes in 5000 image dataset is different to the 500 image dataset?

from yolov7.

shubzk avatar shubzk commented on May 27, 2024

The number of classes stays the same, so should I make a new yolov7-custom.yaml file and write the custom number of classes, and then use that?
I think I might be missing some fundamental knowledge, because to me this sounds like this model can't be used for continuous improvement with new datasets?

from yolov7.

dsbyprateekg avatar dsbyprateekg commented on May 27, 2024

The number of classes(nc) must be changed in your data/custom.yaml and cfg/training/yolov7-custom.yaml from default(80) to yours.

from yolov7.

shubzk avatar shubzk commented on May 27, 2024

So if I do this I can do incremental training? Meaning, suppose I get 500 images every week, and I want to improve the model, I can train the model with 500 images every week with the weight file from the previous week?

from yolov7.

dsbyprateekg avatar dsbyprateekg commented on May 27, 2024

No, you cannot.
You have to add new image to your existing 5000 dataset and then start training using command-
python train.py --workers 8 --device 0 --batch-size 8 --data data/data.yaml --img 1024 1024 --cfg cfg/training/yolov7.yaml --weights '' --name yolov7 --hyp data/hyp.scratch.p5.yaml

Here weight will be retained yolo not the weight you trained earlier like 5000.pt.

from yolov7.

shubzk avatar shubzk commented on May 27, 2024

So basically, everytime I get new data, I need to train the model from scratch? So I can't improve the model with new data?

from yolov7.

dsbyprateekg avatar dsbyprateekg commented on May 27, 2024

This is the only way we follow with our custom data.
Every time the new images we get where detection is failing, we annotate--add those in the existing dataset--and retrain the model from starting.

from yolov7.

shubzk avatar shubzk commented on May 27, 2024

So could you please give me use case of transfer learning (I think I am unable the understand the point of the transfer learning code in this case)? Thank you for your help.

from yolov7.

dsbyprateekg avatar dsbyprateekg commented on May 27, 2024

This is transfer learning only- train a custom dataset using a pre-trained weight to detect our custom classes.
Only the way you were doing is wrong.

from yolov7.

shubzk avatar shubzk commented on May 27, 2024

Can i get in touch with you through whatsapp? Need some guidance, and you seem very experienced in this matter. My email ID - [email protected].

from yolov7.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.