forked from weecology/DeepForest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile_evaluate.py
30 lines (25 loc) · 871 Bytes
/
profile_evaluate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#Profile the dataset class
from deepforest import evaluate
from deepforest import main
from deepforest import get_data
import pandas as pd
import os
import cProfile, pstats
def run(m):
csv_file = get_data("OSBS_029.csv")
predictions = m.predict_file(csv_file=csv_file, root_dir=os.path.dirname(csv_file))
predictions.label = "Tree"
ground_truth = pd.read_csv(csv_file)
results = evaluate.evaluate(predictions=predictions, ground_df=ground_truth, root_dir=os.path.dirname(csv_file), savedir=None)
if __name__ == "__main__":
m = main.deepforest()
m.use_release()
profiler = cProfile.Profile()
profiler.enable()
m = main.deepforest()
m.use_release()
run(m)
profiler.disable()
stats = pstats.Stats(profiler).sort_stats('cumtime')
stats.print_stats()
stats.dump_stats('evaluate.prof')