Fix typo
Browse files
README.md
CHANGED
|
@@ -21,9 +21,7 @@ import { AutoModel, AutoProcessor, RawImage } from '@xenova/transformers';
|
|
| 21 |
|
| 22 |
// Load model and processor
|
| 23 |
const model_id = 'Xenova/RTMO-t';
|
| 24 |
-
const model = await AutoModel.from_pretrained(model_id
|
| 25 |
-
quantized: false,
|
| 26 |
-
});
|
| 27 |
const processor = await AutoProcessor.from_pretrained(model_id);
|
| 28 |
|
| 29 |
// Read image and run processor
|
|
@@ -37,8 +35,8 @@ const { dets, keypoints } = await model({ input: pixel_values });
|
|
| 37 |
// Select the first image
|
| 38 |
const predicted_boxes = dets.tolist()[0];
|
| 39 |
const predicted_points = keypoints.tolist()[0];
|
| 40 |
-
const [
|
| 41 |
-
const [
|
| 42 |
|
| 43 |
// Compute scale values
|
| 44 |
const xScale = width / resized_width;
|
|
@@ -48,7 +46,7 @@ const yScale = height / resized_height;
|
|
| 48 |
const point_threshold = 0.3;
|
| 49 |
const box_threshold = 0.3;
|
| 50 |
|
| 51 |
-
//
|
| 52 |
for (let i = 0; i < predicted_boxes.length; ++i) {
|
| 53 |
const [xmin, ymin, xmax, ymax, box_score] = predicted_boxes[i];
|
| 54 |
if (box_score < box_threshold) continue;
|
|
@@ -74,60 +72,66 @@ for (let i = 0; i < predicted_boxes.length; ++i) {
|
|
| 74 |
<summary>See example output</summary>
|
| 75 |
|
| 76 |
```
|
| 77 |
-
Found person at [
|
| 78 |
-
- nose: (
|
| 79 |
-
- left_eye: (
|
| 80 |
-
- right_eye: (
|
| 81 |
-
- left_shoulder: (
|
| 82 |
-
- right_shoulder: (
|
| 83 |
-
- left_elbow: (
|
| 84 |
-
- right_elbow: (
|
| 85 |
-
- left_wrist: (
|
| 86 |
-
- right_wrist: (
|
| 87 |
-
- left_hip: (
|
| 88 |
-
- right_hip: (
|
| 89 |
-
- left_knee: (
|
| 90 |
-
- right_knee: (
|
| 91 |
-
- left_ankle: (
|
| 92 |
-
- right_ankle: (
|
| 93 |
-
Found person at [
|
| 94 |
-
- left_shoulder: (
|
| 95 |
-
- right_shoulder: (
|
| 96 |
-
- left_elbow: (
|
| 97 |
-
- right_elbow: (
|
| 98 |
-
- left_wrist: (
|
| 99 |
-
- right_wrist: (
|
| 100 |
-
- left_hip: (
|
| 101 |
-
- right_hip: (
|
| 102 |
-
- left_knee: (
|
| 103 |
-
- right_knee: (
|
| 104 |
-
- left_ankle: (
|
| 105 |
-
- right_ankle: (
|
| 106 |
-
Found person at [-
|
| 107 |
-
- nose: (
|
| 108 |
-
-
|
| 109 |
-
-
|
| 110 |
-
-
|
| 111 |
-
-
|
| 112 |
-
-
|
| 113 |
-
-
|
| 114 |
-
-
|
| 115 |
-
-
|
| 116 |
-
-
|
| 117 |
-
-
|
| 118 |
-
-
|
| 119 |
-
-
|
| 120 |
-
|
| 121 |
-
-
|
| 122 |
-
|
| 123 |
-
-
|
| 124 |
-
-
|
| 125 |
-
-
|
| 126 |
-
-
|
| 127 |
-
-
|
| 128 |
-
-
|
| 129 |
-
-
|
| 130 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
```
|
| 132 |
|
| 133 |
</details>
|
|
|
|
| 21 |
|
| 22 |
// Load model and processor
|
| 23 |
const model_id = 'Xenova/RTMO-t';
|
| 24 |
+
const model = await AutoModel.from_pretrained(model_id);
|
|
|
|
|
|
|
| 25 |
const processor = await AutoProcessor.from_pretrained(model_id);
|
| 26 |
|
| 27 |
// Read image and run processor
|
|
|
|
| 35 |
// Select the first image
|
| 36 |
const predicted_boxes = dets.tolist()[0];
|
| 37 |
const predicted_points = keypoints.tolist()[0];
|
| 38 |
+
const [height, width] = original_sizes[0];
|
| 39 |
+
const [resized_height, resized_width] = reshaped_input_sizes[0];
|
| 40 |
|
| 41 |
// Compute scale values
|
| 42 |
const xScale = width / resized_width;
|
|
|
|
| 46 |
const point_threshold = 0.3;
|
| 47 |
const box_threshold = 0.3;
|
| 48 |
|
| 49 |
+
// Display results
|
| 50 |
for (let i = 0; i < predicted_boxes.length; ++i) {
|
| 51 |
const [xmin, ymin, xmax, ymax, box_score] = predicted_boxes[i];
|
| 52 |
if (box_score < box_threshold) continue;
|
|
|
|
| 72 |
<summary>See example output</summary>
|
| 73 |
|
| 74 |
```
|
| 75 |
+
Found person at [411.10, 63.87, 647.68, 505.40] with score 0.986
|
| 76 |
+
- nose: (526.09, 119.83) with score 0.874
|
| 77 |
+
- left_eye: (539.01, 110.39) with score 0.696
|
| 78 |
+
- right_eye: (512.50, 111.08) with score 0.662
|
| 79 |
+
- left_shoulder: (563.59, 171.10) with score 0.999
|
| 80 |
+
- right_shoulder: (467.38, 160.82) with score 0.999
|
| 81 |
+
- left_elbow: (572.72, 240.61) with score 0.999
|
| 82 |
+
- right_elbow: (437.86, 218.20) with score 0.998
|
| 83 |
+
- left_wrist: (603.74, 303.53) with score 0.995
|
| 84 |
+
- right_wrist: (506.01, 218.68) with score 0.992
|
| 85 |
+
- left_hip: (536.00, 306.25) with score 1.000
|
| 86 |
+
- right_hip: (472.79, 311.69) with score 0.999
|
| 87 |
+
- left_knee: (580.82, 366.38) with score 0.996
|
| 88 |
+
- right_knee: (500.25, 449.72) with score 0.954
|
| 89 |
+
- left_ankle: (572.21, 449.52) with score 0.993
|
| 90 |
+
- right_ankle: (541.37, 436.71) with score 0.916
|
| 91 |
+
Found person at [93.58, 19.64, 492.62, 522.45] with score 0.909
|
| 92 |
+
- left_shoulder: (233.76, 109.57) with score 0.971
|
| 93 |
+
- right_shoulder: (229.56, 100.34) with score 0.950
|
| 94 |
+
- left_elbow: (317.31, 162.73) with score 0.950
|
| 95 |
+
- right_elbow: (229.98, 179.31) with score 0.934
|
| 96 |
+
- left_wrist: (385.59, 219.03) with score 0.870
|
| 97 |
+
- right_wrist: (161.31, 230.74) with score 0.952
|
| 98 |
+
- left_hip: (351.23, 243.42) with score 0.998
|
| 99 |
+
- right_hip: (361.94, 240.70) with score 0.999
|
| 100 |
+
- left_knee: (297.77, 382.00) with score 0.998
|
| 101 |
+
- right_knee: (306.07, 393.59) with score 1.000
|
| 102 |
+
- left_ankle: (413.48, 354.16) with score 1.000
|
| 103 |
+
- right_ankle: (445.30, 488.11) with score 0.999
|
| 104 |
+
Found person at [-1.46, 50.68, 160.66, 371.74] with score 0.780
|
| 105 |
+
- nose: (80.17, 81.16) with score 0.570
|
| 106 |
+
- left_eye: (85.17, 75.45) with score 0.383
|
| 107 |
+
- right_eye: (70.20, 77.09) with score 0.382
|
| 108 |
+
- left_shoulder: (121.30, 114.98) with score 0.981
|
| 109 |
+
- right_shoulder: (46.56, 114.41) with score 0.981
|
| 110 |
+
- left_elbow: (144.09, 163.76) with score 0.777
|
| 111 |
+
- right_elbow: (29.69, 159.24) with score 0.886
|
| 112 |
+
- left_wrist: (142.31, 205.64) with score 0.725
|
| 113 |
+
- right_wrist: (6.24, 199.62) with score 0.876
|
| 114 |
+
- left_hip: (108.07, 208.90) with score 0.992
|
| 115 |
+
- right_hip: (64.72, 212.01) with score 0.996
|
| 116 |
+
- left_knee: (115.26, 276.52) with score 0.998
|
| 117 |
+
- right_knee: (65.09, 283.25) with score 0.998
|
| 118 |
+
- left_ankle: (126.09, 340.42) with score 0.991
|
| 119 |
+
- right_ankle: (63.88, 348.88) with score 0.977
|
| 120 |
+
Found person at [526.35, 36.25, 650.42, 280.90] with score 0.328
|
| 121 |
+
- nose: (554.06, 71.87) with score 0.901
|
| 122 |
+
- left_eye: (562.10, 66.30) with score 0.928
|
| 123 |
+
- right_eye: (546.65, 66.36) with score 0.746
|
| 124 |
+
- left_ear: (575.98, 68.17) with score 0.658
|
| 125 |
+
- left_shoulder: (588.04, 102.61) with score 0.999
|
| 126 |
+
- right_shoulder: (526.00, 102.94) with score 0.704
|
| 127 |
+
- left_elbow: (618.11, 149.18) with score 0.984
|
| 128 |
+
- left_wrist: (630.77, 189.42) with score 0.961
|
| 129 |
+
- left_hip: (578.74, 181.42) with score 0.966
|
| 130 |
+
- right_hip: (530.33, 176.46) with score 0.698
|
| 131 |
+
- left_knee: (568.74, 233.01) with score 0.958
|
| 132 |
+
- right_knee: (542.44, 243.87) with score 0.687
|
| 133 |
+
- left_ankle: (585.17, 284.79) with score 0.838
|
| 134 |
+
- right_ankle: (550.07, 292.19) with score 0.435
|
| 135 |
```
|
| 136 |
|
| 137 |
</details>
|