Skip to content

Commit d7bb27e

Browse files
authored
update workflow (#66)
1 parent 7720fc4 commit d7bb27e

21 files changed

Lines changed: 249 additions & 249 deletions

File tree

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ assignees: ''
77
---
88

99
**Is your feature request related to a problem? Please describe.**
10-
A clear and concise description of what the problem is. Ex. I'm always frustrated when \[...\]
10+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
1111

1212
**Describe the solution you'd like**
1313
A clear and concise description of what you want to happen.

.github/workflows/build.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ jobs:
3333
- os: windows-latest
3434
cibw_archs: ARM64
3535
cibw_skip: "pp*"
36-
- os: macos-13
37-
cibw_archs: x86_64
38-
cibw_skip: "pp*"
3936
- os: macos-14
4037
cibw_archs: arm64
4138
cibw_skip: "pp*"

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Python
2121
uses: actions/setup-python@v5
2222
with:
23-
python-version: '3.11'
23+
python-version: '3.13'
2424

2525
- name: Install pandoc
2626
run: sudo apt-get update && sudo apt-get install -y pandoc

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: False
1313
matrix:
1414
os: [ubuntu-latest, macos-14, windows-latest]
15-
pythonv: ["3.8", "3.x"]
15+
pythonv: ["3.8", "3.13"]
1616

1717
steps:
1818
- uses: actions/checkout@v4

.github/workflows/unittest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/checkout@v4
1313
- uses: actions/setup-python@v5
1414
with:
15-
python-version: "3.11"
15+
python-version: "3.13"
1616

1717
- name: Install from sdist
1818
shell: bash

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ci:
88

99
repos:
1010
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v5.0.0
11+
rev: v6.0.0
1212
hooks:
1313
- id: end-of-file-fixer
1414
exclude: "csrc/faster_eval_api/coco_eval/json\\.hpp"
@@ -22,14 +22,14 @@ repos:
2222
- id: detect-private-key
2323

2424
- repo: https://github.com/PyCQA/docformatter
25-
rev: 06907d0
25+
rev: v1.7.7
2626
hooks:
2727
- id: docformatter
2828
additional_dependencies: [tomli]
2929
args: ["--in-place"]
3030

3131
- repo: https://github.com/executablebooks/mdformat
32-
rev: 0.7.17
32+
rev: 0.7.19
3333
hooks:
3434
- id: mdformat
3535
args: ["--number"]
@@ -39,7 +39,7 @@ repos:
3939
- mdformat_frontmatter
4040

4141
- repo: https://github.com/astral-sh/ruff-pre-commit
42-
rev: v0.6.9
42+
rev: v0.14.10
4343
hooks:
4444
- id: ruff
4545
args: ["--fix"]
@@ -48,7 +48,7 @@ repos:
4848

4949
# C++: clang-format (autoformatting)
5050
- repo: https://github.com/pre-commit/mirrors-clang-format
51-
rev: v17.0.6
51+
rev: v21.1.8
5252
hooks:
5353
- id: clang-format
5454
args: ["-style={BasedOnStyle: Google, IndentWidth: 8}", "--fallback-style=Google"]

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
106106
### 4. Permanent Ban
107107

108108
**Community Impact**: Demonstrating a pattern of violation of community
109-
standards, including sustained inappropriate behavior, harassment of an
109+
standards, including sustained inappropriate behavior, harassment of an
110110
individual, or aggression toward or disparagement of classes of individuals.
111111

112112
**Consequence**: A permanent ban from any sort of public interaction within

csrc/faster_eval_api/coco_eval/cocoeval.cpp

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace coco_eval {
1414

1515
namespace COCOeval {
1616
template <typename T>
17-
int64_t v_index(const std::vector<T> &v, const T &key) {
17+
int64_t v_index(const std::vector<T>& v, const T& key) {
1818
auto itr = std::find(v.begin(), v.end(), key);
1919

2020
if (itr != v.cend()) {
@@ -29,8 +29,8 @@ int64_t v_index(const std::vector<T> &v, const T &key) {
2929
// detection_instances[detection_sorted_indices[t+1]]. Use stable_sort to match
3030
// original COCO API
3131
void SortInstancesByDetectionScore(
32-
const std::vector<InstanceAnnotation> &detection_instances,
33-
std::vector<uint64_t> *detection_sorted_indices) {
32+
const std::vector<InstanceAnnotation>& detection_instances,
33+
std::vector<uint64_t>* detection_sorted_indices) {
3434
detection_sorted_indices->resize(detection_instances.size());
3535
std::iota(detection_sorted_indices->begin(),
3636
detection_sorted_indices->end(), 0);
@@ -45,10 +45,10 @@ void SortInstancesByDetectionScore(
4545
// Partition the ground truth objects based on whether or not to ignore them
4646
// based on area
4747
void SortInstancesByIgnore(
48-
const std::array<double, 2> &area_range,
49-
const std::vector<InstanceAnnotation> &ground_truth_instances,
50-
std::vector<uint64_t> *ground_truth_sorted_indices,
51-
std::vector<bool> *ignores) {
48+
const std::array<double, 2>& area_range,
49+
const std::vector<InstanceAnnotation>& ground_truth_instances,
50+
std::vector<uint64_t>* ground_truth_sorted_indices,
51+
std::vector<bool>* ignores) {
5252
ignores->clear();
5353
ignores->reserve(ground_truth_instances.size());
5454
for (auto o : ground_truth_instances) {
@@ -70,29 +70,29 @@ void SortInstancesByIgnore(
7070
// For each IOU threshold, greedily match each detected instance to a ground
7171
// truth instance (if possible) and store the results
7272
void MatchDetectionsToGroundTruth(
73-
const std::vector<InstanceAnnotation> &detection_instances,
74-
const std::vector<uint64_t> &detection_sorted_indices,
75-
const std::vector<InstanceAnnotation> &ground_truth_instances,
76-
const std::vector<uint64_t> &ground_truth_sorted_indices,
77-
const std::vector<bool> &ignores,
78-
const std::vector<std::vector<double>> &ious,
79-
const std::vector<double> &iou_thresholds,
80-
const std::array<double, 2> &area_range, ImageEvaluation *results) {
73+
const std::vector<InstanceAnnotation>& detection_instances,
74+
const std::vector<uint64_t>& detection_sorted_indices,
75+
const std::vector<InstanceAnnotation>& ground_truth_instances,
76+
const std::vector<uint64_t>& ground_truth_sorted_indices,
77+
const std::vector<bool>& ignores,
78+
const std::vector<std::vector<double>>& ious,
79+
const std::vector<double>& iou_thresholds,
80+
const std::array<double, 2>& area_range, ImageEvaluation* results) {
8181
// Initialize memory to store return data matches and ignore
8282
const int num_iou_thresholds = (const int)iou_thresholds.size();
8383
const int num_ground_truth =
8484
(const int)ground_truth_sorted_indices.size();
8585
const int num_detections = (const int)detection_sorted_indices.size();
8686
// std::vector<uint64_t> ground_truth_matches(
8787
// num_iou_thresholds * num_ground_truth, 0);
88-
std::vector<int64_t> &ground_truth_matches =
88+
std::vector<int64_t>& ground_truth_matches =
8989
results->ground_truth_matches;
9090
ground_truth_matches.resize(num_iou_thresholds * num_ground_truth, 0);
9191

92-
std::vector<int64_t> &detection_matches = results->detection_matches;
92+
std::vector<int64_t>& detection_matches = results->detection_matches;
9393

94-
std::vector<bool> &detection_ignores = results->detection_ignores;
95-
std::vector<bool> &ground_truth_ignores = results->ground_truth_ignores;
94+
std::vector<bool>& detection_ignores = results->detection_ignores;
95+
std::vector<bool>& ground_truth_ignores = results->ground_truth_ignores;
9696
detection_matches.resize(num_iou_thresholds * num_detections, 0);
9797
detection_ignores.resize(num_iou_thresholds * num_detections, false);
9898
ground_truth_ignores.resize(num_ground_truth);
@@ -166,7 +166,7 @@ void MatchDetectionsToGroundTruth(
166166

167167
// set unmatched detections outside of area range to
168168
// ignore
169-
const InstanceAnnotation &detection =
169+
const InstanceAnnotation& detection =
170170
detection_instances[detection_sorted_indices[d]];
171171
detection_ignores[t * num_detections + d] =
172172
detection_ignores[t * num_detections + d] ||
@@ -186,11 +186,11 @@ void MatchDetectionsToGroundTruth(
186186
}
187187

188188
std::vector<ImageEvaluation> EvaluateImages(
189-
const std::vector<std::array<double, 2>> &area_ranges, int max_detections,
190-
const std::vector<double> &iou_thresholds,
191-
const ImageCategoryInstances<std::vector<double>> &image_category_ious,
192-
const LightweightDataset &gt_dataset, const LightweightDataset &dt_dataset,
193-
const std::vector<double> &img_ids, const std::vector<double> &cat_ids,
189+
const std::vector<std::array<double, 2>>& area_ranges, int max_detections,
190+
const std::vector<double>& iou_thresholds,
191+
const ImageCategoryInstances<std::vector<double>>& image_category_ious,
192+
const LightweightDataset& gt_dataset, const LightweightDataset& dt_dataset,
193+
const std::vector<double>& img_ids, const std::vector<double>& cat_ids,
194194
bool useCats) {
195195
const int num_area_ranges = (const int)area_ranges.size();
196196
const int num_images = (const int)img_ids.size();
@@ -298,7 +298,7 @@ std::vector<ImageEvaluation> EvaluateImages(
298298

299299
// Convert a python list to a vector
300300
template <typename T>
301-
std::vector<T> list_to_vec(const py::list &l) {
301+
std::vector<T> list_to_vec(const py::list& l) {
302302
std::vector<T> v(py::len(l));
303303
for (int i = 0; i < (int)py::len(l); ++i) {
304304
v[i] = l[i].cast<T>();
@@ -318,13 +318,13 @@ std::vector<T> list_to_vec(const py::list &l) {
318318
// and is the image_detection_indices[i]'th of the list of detections
319319
// for the image containing i. detection_sorted_indices[] defines a sorted
320320
// permutation of the 3 other outputs
321-
int BuildSortedDetectionList(const std::vector<ImageEvaluation> &evaluations,
321+
int BuildSortedDetectionList(const std::vector<ImageEvaluation>& evaluations,
322322
const int64_t evaluation_index,
323323
const int64_t num_images, const int max_detections,
324-
std::vector<uint64_t> *evaluation_indices,
325-
std::vector<double> *detection_scores,
326-
std::vector<uint64_t> *detection_sorted_indices,
327-
std::vector<uint64_t> *image_detection_indices) {
324+
std::vector<uint64_t>* evaluation_indices,
325+
std::vector<double>* detection_scores,
326+
std::vector<uint64_t>* detection_sorted_indices,
327+
std::vector<uint64_t>* image_detection_indices) {
328328
assert(evaluations.size() >= evaluation_index + num_images);
329329

330330
// Extract a list of object instances of the applicable category, area
@@ -337,7 +337,7 @@ int BuildSortedDetectionList(const std::vector<ImageEvaluation> &evaluations,
337337
detection_scores->reserve(num_images * max_detections);
338338
int num_valid_ground_truth = 0;
339339
for (auto i = 0; i < num_images; ++i) {
340-
const ImageEvaluation &evaluation =
340+
const ImageEvaluation& evaluation =
341341
evaluations[evaluation_index + i];
342342

343343
for (int d = 0; d < (int)evaluation.detection_scores.size() &&
@@ -382,16 +382,16 @@ int BuildSortedDetectionList(const std::vector<ImageEvaluation> &evaluations,
382382
void ComputePrecisionRecallCurve(
383383
const int64_t precisions_out_index, const int64_t precisions_out_stride,
384384
const int64_t recalls_out_index,
385-
const std::vector<double> &recall_thresholds, const int iou_threshold_index,
385+
const std::vector<double>& recall_thresholds, const int iou_threshold_index,
386386
const int num_iou_thresholds, const int num_valid_ground_truth,
387-
const std::vector<ImageEvaluation> &evaluations,
388-
const std::vector<uint64_t> &evaluation_indices,
389-
const std::vector<double> &detection_scores,
390-
const std::vector<uint64_t> &detection_sorted_indices,
391-
const std::vector<uint64_t> &image_detection_indices,
392-
std::vector<double> *precisions, std::vector<double> *recalls,
393-
std::vector<double> *precisions_out, std::vector<double> *scores_out,
394-
std::vector<double> *recalls_out) {
387+
const std::vector<ImageEvaluation>& evaluations,
388+
const std::vector<uint64_t>& evaluation_indices,
389+
const std::vector<double>& detection_scores,
390+
const std::vector<uint64_t>& detection_sorted_indices,
391+
const std::vector<uint64_t>& image_detection_indices,
392+
std::vector<double>* precisions, std::vector<double>* recalls,
393+
std::vector<double>* precisions_out, std::vector<double>* scores_out,
394+
std::vector<double>* recalls_out) {
395395
assert(recalls_out->size() > recalls_out_index);
396396

397397
// Compute precision/recall for each instance in the sorted list of
@@ -403,7 +403,7 @@ void ComputePrecisionRecallCurve(
403403
recalls->reserve(detection_sorted_indices.size());
404404
assert(!evaluations.empty() || detection_sorted_indices.empty());
405405
for (auto detection_sorted_index : detection_sorted_indices) {
406-
const ImageEvaluation &evaluation =
406+
const ImageEvaluation& evaluation =
407407
evaluations[evaluation_indices[detection_sorted_index]];
408408
const auto num_detections =
409409
evaluation.detection_matches.size() / num_iou_thresholds;
@@ -473,8 +473,8 @@ void ComputePrecisionRecallCurve(
473473
}
474474
}
475475
}
476-
py::dict Accumulate(const py::object &params,
477-
const std::vector<ImageEvaluation> &evaluations) {
476+
py::dict Accumulate(const py::object& params,
477+
const std::vector<ImageEvaluation>& evaluations) {
478478
const std::vector<double> recall_thresholds =
479479
list_to_vec<double>(params.attr("recThrs"));
480480
const std::vector<int> max_detections =
@@ -661,10 +661,10 @@ py::dict Accumulate(const py::object &params,
661661
}
662662

663663
py::dict EvaluateAccumulate(
664-
const py::object &params,
665-
const ImageCategoryInstances<std::vector<double>> &image_category_ious,
666-
const LightweightDataset &gt_dataset, const LightweightDataset &dt_dataset,
667-
const std::vector<double> &img_ids, const std::vector<double> &cat_ids,
664+
const py::object& params,
665+
const ImageCategoryInstances<std::vector<double>>& image_category_ious,
666+
const LightweightDataset& gt_dataset, const LightweightDataset& dt_dataset,
667+
const std::vector<double>& img_ids, const std::vector<double>& cat_ids,
668668
bool useCats) {
669669
const std::vector<int> max_detections =
670670
list_to_vec<int>(params.attr("maxDets"));
@@ -686,8 +686,8 @@ py::dict EvaluateAccumulate(
686686
// non-increasing. Arguments:
687687
// recall_list: vector of recall values (must be sorted in increasing order)
688688
// precision_list: vector of precision values (same size as recall_list)
689-
long double calc_auc(const std::vector<long double> &recall_list,
690-
const std::vector<long double> &precision_list) {
689+
long double calc_auc(const std::vector<long double>& recall_list,
690+
const std::vector<long double>& precision_list) {
691691
// Make a copy of precision_list to enforce monotonicity.
692692
std::vector<long double> mpre = precision_list;
693693

csrc/faster_eval_api/coco_eval/cocoeval.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,30 +59,30 @@ using ImageCategoryInstances = std::vector<std::vector<std::vector<T>>>;
5959
// image_category_detection_instances[i][c] is a vector of detected
6060
// instances in image image_ids[i] of category category_ids[c]
6161
std::vector<ImageEvaluation> EvaluateImages(
62-
const std::vector<std::array<double, 2>>
63-
&area_ranges, // vector of 2-tuples
64-
int max_detections, const std::vector<double> &iou_thresholds,
65-
const ImageCategoryInstances<std::vector<double>> &image_category_ious,
66-
const LightweightDataset &gt_dataset, const LightweightDataset &dt_dataset,
67-
const std::vector<double> &img_ids, const std::vector<double> &cat_ids,
62+
const std::vector<std::array<double, 2>>&
63+
area_ranges, // vector of 2-tuples
64+
int max_detections, const std::vector<double>& iou_thresholds,
65+
const ImageCategoryInstances<std::vector<double>>& image_category_ious,
66+
const LightweightDataset& gt_dataset, const LightweightDataset& dt_dataset,
67+
const std::vector<double>& img_ids, const std::vector<double>& cat_ids,
6868
bool useCats);
6969

7070
// C++ implementation of COCOeval.accumulate(), which generates precision
7171
// recall curves for each set of category, IOU threshold, detection area range,
7272
// and max number of detections parameters. It is assumed that the parameter
7373
// evaluations is the return value of the functon COCOeval::EvaluateImages(),
7474
// which was called with the same parameter settings params
75-
py::dict Accumulate(const py::object &params,
76-
const std::vector<ImageEvaluation> &evalutations);
75+
py::dict Accumulate(const py::object& params,
76+
const std::vector<ImageEvaluation>& evalutations);
7777

7878
py::dict EvaluateAccumulate(
79-
const py::object &params,
80-
const ImageCategoryInstances<std::vector<double>> &image_category_ious,
81-
const LightweightDataset &gt_dataset, const LightweightDataset &dt_dataset,
82-
const std::vector<double> &img_ids, const std::vector<double> &cat_ids,
79+
const py::object& params,
80+
const ImageCategoryInstances<std::vector<double>>& image_category_ious,
81+
const LightweightDataset& gt_dataset, const LightweightDataset& dt_dataset,
82+
const std::vector<double>& img_ids, const std::vector<double>& cat_ids,
8383
bool useCats);
8484

85-
long double calc_auc(const std::vector<long double> &recall_list,
86-
const std::vector<long double> &precision_list);
85+
long double calc_auc(const std::vector<long double>& recall_list,
86+
const std::vector<long double>& precision_list);
8787
} // namespace COCOeval
8888
} // namespace coco_eval

0 commit comments

Comments
 (0)