- Clone
yolov7
repogit clone https://github.com/WongKinYiu/yolov7.git
- Download
yolov7
trained weights from here and put it in yolov7 directory.wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt
- Install all necessary dependency using pip
- Put
training_pipeline.ipynb, custom_scripts, model_prediction_custom.ipynb, visulization_pipeline.ipynb
inyolov7
directory
training_pipeline.ipynb
containsdata_preprocess
and model training module.tif
file andgeojson
file is required to run script.- The data will preprocess in first phase and stored images and their label in
txt
format on given path. - After data preprocess if the
aug
flag is TRUE then data augmentation will start and after augmentation data will be divided in train and validation set. Ifaug
flag is FALSE then data will directly divide into train and validation dataset (ratio is training = 80, validation = 20). - After the creation of the
validation_set
andtraining_set
model the training will start. You can change the parameter in yolo class for training. - The trained model is saved in the given path.
- In the weights directory
best.pt
is best model. But you can save it on different location.
data_augmentation.py
file is required for data augmentation.- default
cropping_size = 2500
. This means the image will be croped from maintif
file with height, width = 2500. set cropping size according to your needs. - For a better model accuracy keep
crop_size
same for model training as well as model prediction.
model_prediction_custom.ipynb
will accept (tif
file andmodel_weights
) and save predicted images in given directory. The model.pt
file is required for model prediction.
visualization_pipeline.ipynb
will accepttif
file andgeojson
file as input and visualize bounding box. You can use this script to verify input/predicted data.