-
Follow the installation instructions from README.md
-
(Optional step if not using the docker container) Make sure to also install the requirements of this project (we do recommend using a virtual environment)
pip install -r requirements.txt
-
Place your signet ring dataset on a suitable folder which can be accessed from this application.
-
Make a copy of the settings template.
cp settings_template.py settings.py
-
Open your settings.py and modify the paths for your database properly and train/test pickle files properly (the latter will be created in the next step).
-
Create split your database and create your pickle files
from utils.data import get_or_create_train_test_files
get_or_create_train_test_files(test_size=0.8, random_state=42, shuffle=True, force_create=True)
-
The configuration files for training and testing are located at:
config/yolov3_default_digestpath.cfg
config/yolov3_eval_digestpath.cfg
-
If you want to re-calculate the anchor boxes for your dataset you can do it by running the function recalculate_anchor_boxes_kmeans_iou, then you just need to update the ANCHORS on both configuration files.
from constants import Dataset
from utils.utils import recalculate_anchor_boxes_kmeans_iou
new_anchors = recalculate_anchor_boxes_kmeans_iou(Dataset.SIGNET_RING, print_results=True, num_centroids=9)
print(new_anchors)
-
Based on the size of your images and hardware especifications you should update the following variables from the configuration files:
MAXITER, BATCHSIZE, SUBDIVISION, IMGSIZE
. -
Other customizations could be done on
CONFTHRE and NMSTHRE
.
import os
os.system('python train.py --weights_path weights/darknet53.conv.74 --tfboard True --checkpoint_interval=50 --eval_interval=50')
Quick example using our provided checkpoint
-
Get sample checkpoint. Download it at the same folder were input_sample is located.
git clone [email protected]:giussepi/PyTorch_YOLOv3_sample_checkpoint.git
-
Rename
PyTorch_YOLOv3_sample_checkpoint
folder.mv PyTorch_YOLOv3_sample_checkpoint checkpoints
-
Run the evaluation command.
import os
os.system('python train.py --cfg config/yolov3_eval_digestpath.cfg --eval_interval 1 --checkpoint "checkpoints/confthre_0_dot_8/snapshot17350.ckpt"')