Spaces:
Build error
Build error
Nadine Rueegg
commited on
Commit
·
0d2dc80
1
Parent(s):
bfb8d88
update description and add counter
Browse files- scripts/gradio_demo.py +10 -6
scripts/gradio_demo.py
CHANGED
|
@@ -31,6 +31,7 @@ import trimesh
|
|
| 31 |
import cv2
|
| 32 |
import shutil
|
| 33 |
import random
|
|
|
|
| 34 |
import gradio as gr
|
| 35 |
|
| 36 |
import torchvision
|
|
@@ -576,8 +577,14 @@ def run_bite_inference(input_image, bbox=None, apply_ttopt=True):
|
|
| 576 |
|
| 577 |
# -------------------------------------------------------------------------------------------------------------------- #
|
| 578 |
|
|
|
|
| 579 |
|
| 580 |
def run_complete_inference(img_path_or_img, crop_choice, use_ttopt):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 581 |
# depending on crop_choice: run faster r-cnn or take the input image directly
|
| 582 |
if crop_choice == "input image is cropped":
|
| 583 |
if isinstance(img_path_or_img, str):
|
|
@@ -613,9 +620,9 @@ description = '''
|
|
| 613 |
|
| 614 |
#### Description
|
| 615 |
This is a demo for BITE (*B*eyond Priors for *I*mproved *T*hree-{D} Dog Pose *E*stimation).
|
|
|
|
| 616 |
You can either submit a cropped image or choose the option to run a pretrained Faster R-CNN in order to obtain a bounding box.
|
| 617 |
-
|
| 618 |
-
Please have a look at the examples below.
|
| 619 |
<details>
|
| 620 |
|
| 621 |
<summary>More</summary>
|
|
@@ -635,14 +642,11 @@ Please have a look at the examples below.
|
|
| 635 |
#### Image Sources
|
| 636 |
* Stanford extra image dataset
|
| 637 |
* Images from google search engine
|
| 638 |
-
* https://www.dogtrainingnation.com/wp-content/uploads/2015/02/keep-dog-training-sessions-short.jpghttps://www.ktvb.com/article/news/local/dogs-can-now-be-off-leash-again-in-boises-ann-morrison-park-optimist-youth-sports-complex/277-609691113
|
| 639 |
-
* https://thumbs.dreamstime.com/b/hund-und-seine-neue-hundeh%C3%BCtte-36757551.jpg
|
| 640 |
* https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRnx2sHnnLU3zy1XnJB7BvGUR9spmAh5bxTUg&usqp=CAU
|
| 641 |
* https://www.westend61.de/en/imageView/CAVF56467/portrait-of-dog-lying-on-floor-at-home
|
| 642 |
-
* https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTFGxMcePtorQnSJncl6WhQfbR6VRccMq9gqA&usqp=CAU
|
| 643 |
|
| 644 |
#### Disclosure
|
| 645 |
-
The results shown in this demo are slightly improved compared to the ones depicted within our paper
|
| 646 |
|
| 647 |
</details>
|
| 648 |
|
|
|
|
| 31 |
import cv2
|
| 32 |
import shutil
|
| 33 |
import random
|
| 34 |
+
from datetime import datetime
|
| 35 |
import gradio as gr
|
| 36 |
|
| 37 |
import torchvision
|
|
|
|
| 577 |
|
| 578 |
# -------------------------------------------------------------------------------------------------------------------- #
|
| 579 |
|
| 580 |
+
total_count = 0
|
| 581 |
|
| 582 |
def run_complete_inference(img_path_or_img, crop_choice, use_ttopt):
|
| 583 |
+
now = datetime.now()
|
| 584 |
+
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
|
| 585 |
+
global total_count
|
| 586 |
+
total_count += 1
|
| 587 |
+
print(dt_string + ' total count: ' + str(total_count))
|
| 588 |
# depending on crop_choice: run faster r-cnn or take the input image directly
|
| 589 |
if crop_choice == "input image is cropped":
|
| 590 |
if isinstance(img_path_or_img, str):
|
|
|
|
| 620 |
|
| 621 |
#### Description
|
| 622 |
This is a demo for BITE (*B*eyond Priors for *I*mproved *T*hree-{D} Dog Pose *E*stimation).
|
| 623 |
+
To run inference on one of the examples below, click on the desired image and push the submit button. Alternatively, you may upload one of your own images.
|
| 624 |
You can either submit a cropped image or choose the option to run a pretrained Faster R-CNN in order to obtain a bounding box.
|
| 625 |
+
While we recommend enabeling test-time optimization (computation can take up to a minute), you have the possibility to skip it, which will lead to faster calculation (a few seconds) at the cost of less accurate results.
|
|
|
|
| 626 |
<details>
|
| 627 |
|
| 628 |
<summary>More</summary>
|
|
|
|
| 642 |
#### Image Sources
|
| 643 |
* Stanford extra image dataset
|
| 644 |
* Images from google search engine
|
|
|
|
|
|
|
| 645 |
* https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRnx2sHnnLU3zy1XnJB7BvGUR9spmAh5bxTUg&usqp=CAU
|
| 646 |
* https://www.westend61.de/en/imageView/CAVF56467/portrait-of-dog-lying-on-floor-at-home
|
|
|
|
| 647 |
|
| 648 |
#### Disclosure
|
| 649 |
+
The results shown in this demo are slightly improved compared to the ones depicted within our paper, as we apply a regularizer on the tail.
|
| 650 |
|
| 651 |
</details>
|
| 652 |
|