- 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 install requirements.txt
. You need Cuda to install talk to your GPU. - Put
training_pipeline.ipynb, custom_scripts, model_prediction_custom.ipynb, visulization_pipeline.ipynb
inyolov7
directory
training_pipeline.ipynb
containsdata_preprocess
and model training module.- Input data:
tif
file: a RGB image areal with 5cm resolution.geojson
bounding boxes in the same projection as thetif
- The data will preprocess in first phase and stored images and their label in
txt
format on given path. - After the data preprocess and if the
aug
flag is TRUE then data augmentation will start. After the augmentation the data will be divided in training and validation sets. Ifaug
flag is FALSE then data will directly be split into the two sets (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. - All paramters (epochs) can be changed in
config.py
. - 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. This is required if the input data (resolution) changes. - For a better model accuracy keep
crop_size
same for model training as well as model prediction.
prediction_with_geojson.ipynb
will accept (tif
file andmodel_weights
) and save predicted images in given directory. The model.pt
file is required for the model prediction and the path for model weights needs updating to the location ofbest.pt
.- The prediction process script will generate crops from the
tif
file and predict and store the output in the destination folder. If the object is detected a bounding box is drawn on the image. - The script will create a
geojson
file with the realworld coordinates of the the detected objects.
visualization_pipeline.ipynb
will accepttif
file andgeojson
file as input and visualize bounding box. You can use this script to verify input/predicted data.