Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
developer0hye authored Sep 30, 2023
1 parent 4fbb172 commit 390c49f
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,47 @@ pip install onepose
```

```python
import cv2
import onepose
onepose.model("vitpose-s", "Luffy.png")
img = cv2.imread("sample.png")
keypoints = onepose.create_model().to("cuda")(img)
```

![image](https://github.com/developer0hye/onepose/assets/35001605/2f45a9a5-eea2-4ad7-b370-e86abb7c56b5)
![output](https://github.com/developer0hye/onepose/assets/35001605/373de9d0-a2ea-4b34-8b6c-156e5de71377)

One Piece's Luffy pose predicted by onepose

# Examples

## Plot keypoints on an image
```python
import cv2
import onepose

if __name__ == '__main__':
img = cv2.imread('sample.png')
model = onepose.create_model()
out = model(img)
num_keypoints = len(out['points'])

for i in range(num_keypoints):
print(f"Point {i} (x, y) : {out['points'][i]} confidence: {out['confidence'][i]}")

if out['confidence'][i] < 0.5:
color = (0, 0, 255)
else:
color = (0, 255, 0)

cv2.circle(img, (int(out['points'][i][0]), int(out['points'][i][1])), 5, color, -1)
cv2.imshow('img', img)
cv2.waitKey(0)
```
### Results

Notice that occluded key points are plotted in red. You can discard these points using confidence score.

![output](https://github.com/developer0hye/onepose/assets/35001605/efad3e3f-7ab7-4521-bec1-d5cb2f9007a2)

One Piece's Luffy Pose Prediction by onepose

# References

Expand Down

0 comments on commit 390c49f

Please sign in to comment.