Xenova HF staff commited on
Commit
e3e2b4c
·
verified ·
1 Parent(s): b1424a5
Files changed (1) hide show
  1. README.md +64 -60
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 [width, height] = original_sizes[0];
41
- const [resized_width, resized_height] = reshaped_input_sizes[0];
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
- // Parse results
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 [275.55, 99.07, 433.03, 753.93] with score 0.989
78
- - nose: (348.04, 178.71) with score 0.686
79
- - left_eye: (357.65, 166.47) with score 0.347
80
- - right_eye: (341.15, 164.56) with score 0.331
81
- - left_shoulder: (375.16, 258.75) with score 0.999
82
- - right_shoulder: (312.26, 241.00) with score 0.999
83
- - left_elbow: (381.83, 360.03) with score 0.999
84
- - right_elbow: (291.49, 326.95) with score 0.999
85
- - left_wrist: (399.93, 455.04) with score 0.997
86
- - right_wrist: (335.69, 327.09) with score 0.999
87
- - left_hip: (357.00, 457.75) with score 0.999
88
- - right_hip: (317.68, 474.91) with score 0.998
89
- - left_knee: (385.42, 547.58) with score 0.998
90
- - right_knee: (339.32, 648.62) with score 0.953
91
- - left_ankle: (384.14, 699.15) with score 0.990
92
- - right_ankle: (357.63, 621.90) with score 0.906
93
- Found person at [67.16, 23.39, 338.29, 783.70] with score 0.932
94
- - left_shoulder: (157.14, 159.59) with score 0.973
95
- - right_shoulder: (159.63, 144.00) with score 0.872
96
- - left_elbow: (210.02, 242.90) with score 0.982
97
- - right_elbow: (201.28, 231.61) with score 0.694
98
- - left_wrist: (258.17, 330.94) with score 0.978
99
- - right_wrist: (205.45, 305.74) with score 0.654
100
- - left_hip: (231.90, 367.39) with score 0.999
101
- - right_hip: (240.19, 365.36) with score 1.000
102
- - left_knee: (195.22, 574.91) with score 0.999
103
- - right_knee: (216.01, 578.60) with score 1.000
104
- - left_ankle: (283.08, 528.39) with score 1.000
105
- - right_ankle: (300.10, 733.43) with score 0.999
106
- Found person at [-0.17, 75.70, 109.33, 555.50] with score 0.806
107
- - nose: (49.95, 123.09) with score 0.385
108
- - left_shoulder: (78.57, 171.93) with score 0.983
109
- - right_shoulder: (30.76, 174.85) with score 0.974
110
- - left_elbow: (91.19, 248.35) with score 0.859
111
- - right_elbow: (19.49, 241.54) with score 0.877
112
- - left_wrist: (93.19, 314.57) with score 0.812
113
- - right_wrist: (6.06, 301.15) with score 0.899
114
- - left_hip: (69.81, 313.63) with score 0.995
115
- - right_hip: (41.66, 315.41) with score 0.997
116
- - left_knee: (76.36, 416.84) with score 0.999
117
- - right_knee: (44.06, 420.83) with score 0.998
118
- - left_ankle: (83.66, 514.07) with score 0.992
119
- - right_ankle: (44.09, 519.74) with score 0.983
120
- Found person at [348.03, 53.31, 432.29, 526.36] with score 0.328
121
- - left_shoulder: (395.69, 156.16) with score 1.000
122
- - right_shoulder: (351.04, 157.42) with score 0.917
123
- - left_elbow: (413.08, 225.16) with score 0.995
124
- - left_wrist: (418.51, 295.31) with score 0.985
125
- - left_hip: (387.03, 287.25) with score 0.995
126
- - right_hip: (359.71, 286.18) with score 0.939
127
- - left_knee: (389.06, 393.34) with score 0.992
128
- - right_knee: (363.29, 393.47) with score 0.922
129
- - left_ankle: (391.54, 482.10) with score 0.970
130
- - right_ankle: (365.87, 483.47) with score 0.847
 
 
 
 
 
 
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>