Replies: 2 comments 3 replies
-
Let's break this down into pieces so I can understand better. Here is a screenshot of an image
|
Beta Was this translation helpful? Give feedback.
-
I have performed both the steps mentioned by @bw4sz , split raster into smaller tiles. Prepared train and test. Trained for few epochs. Now my question is ,
|
Beta Was this translation helpful? Give feedback.
-
Originally an issue.
"""
Dear all,
This is not an issue reporting but rather a request for guidance pertaining to image sizes, number of classes, data quantity and training on a new multi class model training.
The image files I am using for training are quite large in size ranging from 12563512 pixels (4516 × 2782) to 83678686 (12523 × 6682). Several such image files are used with a single csv file for annotations. There are a total of 2903 annotations across 13 classes.
In general, the code works for me but the predictions are very poor even on the file used for training. The scores for predictions are very low ~0.01 and the bounding boxes don't look right. I am presently unable to train the model for larger epochs due to hardware limitations. Any suggestion this would also be welcome. There is a chance that we might be able to get access to google cola pro or azure sagemaker and that may solve some of these problems.
In general, looking to get an advice on the approach and the architecture. Here is the code.
Dictionary labels are taken from data frame but here is standalone creation
dict_labels = {'Sitaphal': 0, 'Other': 1, 'Mango': 2, 'Lemon': 3, 'Tree': 4, 'Chinch': 5, 'Coconut': 6, 'Jambhul': 7, 'tree': 8, 'Coconut tree': 9, 'chinch': 10, 'coconut': 11, 'w': 12, 'Orange': 13}
Initializing a multi class model
multi_class_m = main.deepforest(num_classes=len(dict_labels), label_dict=dict_labels)
deepforest_release_model = main.deepforest()
deepforest_release_model.use_release()
multi_class_m.model.backbone.load_state_dict(deepforest_release_model.model.backbone.state_dict())
multi_class_m.model.head.regression_head.load_state_dict(deepforest_release_model.model.head.regression_head.state_dict())
Setting configuration for the multi class model
multi_class_m.config["train"]["csv_file"] = get_data("automated_all_annot.csv")
multi_class_m.config["train"]["root_dir"] = os.path.dirname(get_data("automated_all_annot.csv"))
multi_class_m.config["train"]["fast_dev_run"] = False
multi_class_m.config["batch_size"] = 5
multi_class_m.config["train"]['epochs'] = 10
multi_class_m.config["workers"] = 2
Training
multi_class_m.create_trainer(log_every_n_steps=1)
multi_class_m.trainer.fit(multi_class_m)
assert multi_class_m.num_classes == len(dict_labels)
Prediction: score_threshold is kept 0 to see whatever is predicted
test_predict = get_data("AMD-SRD-123456002-PTV-EP01.jpg")
multi_class_m.config["score_thresh"] = 0.0
boxes = multi_class_m.predict_image(path=test_predict, return_plot = True, thickness=10, color = (0, 165, 255))
predictions_df = multi_class_m.predict_image(path=test_predict, return_plot = False, thickness=10, color = (0, 165, 255))
Here is a google drive link to download the folder containing all image files and the annotation csv.
Thank you Ben and all the development team for making this available for us! Much much appreciated. Looking forward to your comments and suggestions.
"""
Beta Was this translation helpful? Give feedback.
All reactions