Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ conda activate BranchPoseNet

Then install the required libraries
```
cd whorl_pose_detector
pip install -r requirements.txt
```

Expand All @@ -31,7 +30,7 @@ For predicting on your own data just point the --dir_root to the path to the fol

### 🖥️ To run using command line (CLI):
```
python whorl_pose_detect_CLI.py --dir_root data --my_model whorl_pose_nano_1000px/weights/best.pt --alpha 0.5 --min_internodal_d 0.3 --tree_id_label treeID --semantic_label semantic
python whorl_pose_detect.py --dir_root data --my_model models/whorl_pose_nano_1000px/weights/best.pt --alpha 0.5 --min_internodal_d 0.3 --tree_id_label treeID --semantic_label semantic
```

### 🎮 Demo version
Expand Down
2 changes: 1 addition & 1 deletion demo_predict_whorl_pose.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"min_internodal_d= 0.3 # in m (it can be set to something like 0.01 to allow the full output to post-process later)\n",
"\n",
"# pose model\n",
"my_model=\"whorl_pose_nano_1000px/weights/best.pt\"\n",
"my_model=\"models/whorl_pose_nano_1000px/weights/best.pt\"\n",
"\n",
"# label for the column with tree instance unique identifiers\n",
"tree_id_label='treeID' \n",
Expand Down
7 changes: 7 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pandas
numpy
laspy[lazrs]
Pillow
scipy
matplotlib
ultralytics
33 changes: 25 additions & 8 deletions whorl_pose_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import matplotlib
matplotlib.use('Agg') # Use Agg backend for non-GUI rendering
import matplotlib.pyplot as plt

import argparse

import ultralytics
from ultralytics import YOLO
Expand All @@ -24,23 +24,37 @@


####################################################################################################################################
# Parse CLI arguments first
parser = argparse.ArgumentParser()
parser.add_argument("--dir_root", default="data", help="Path to root folder where .las/.laz files are stored")
parser.add_argument("--my_model", default="models/whorl_pose_nano_1000px/weights/best.pt", help="Path to YOLO model weights")
parser.add_argument("--alpha", type=float, default=0.5, help="Alpha value for plotting")
parser.add_argument("--min_internodal_d", type=float, default=0.3, help="Minimum internodal distance in meters")
parser.add_argument("--tree_id_label", default="treeID", help="Column name for tree IDs")
parser.add_argument("--semantic_label", default="semantic", help="Column name for semantic labels")
args = parser.parse_args()

# ---------------------------------------------------------
# Default parameters (can be overridden by CLI arguments)
# ---------------------------------------------------------

# directory to where YOLO temp predictions are stored
dir_root="data" # path to root folder where .las/.laz files are stored
dir_root = args.dir_root # path to root folder where .las/.laz files are stored

# alpha for plotting
alpha= 0.5
alpha = args.alpha

# minimum distance between whorls (used to remove duplicates)
min_internodal_d= 0.3 # in m (it can be set to something like 0.01 to allow the full output to post-process later)
min_internodal_d = args.min_internodal_d # in m (can be set to 0.01 to allow full output post-processing later)

# pose model
my_model="whorl_pose_nano_1000px/weights/best.pt"
my_model = args.my_model

# label for the column with tree instance unique identifiers
tree_id_label='treeID'
tree_id_label = args.tree_id_label

# label for the column with semantic labels (non required)
semantic_label='semantic'
# label for the column with semantic labels (non-required)
semantic_label = args.semantic_label

####################################################################################################################################
# files_to_process= list_las_laz_files(dir_root)
Expand Down Expand Up @@ -145,3 +159,6 @@
# Cleanup temp files
import shutil
shutil.rmtree(dir_pred)