Spaces:
Runtime error
Runtime error
cocktailpeanut
commited on
Commit
Β·
4bd8e5a
1
Parent(s):
d15bc68
update
Browse files
preprocess/openpose/annotator/openpose/body.py
CHANGED
@@ -16,6 +16,7 @@ from torchvision import transforms
|
|
16 |
from . import util
|
17 |
from .model import bodypose_model
|
18 |
|
|
|
19 |
|
20 |
class Body(object):
|
21 |
def __init__(self, model_path):
|
@@ -48,8 +49,9 @@ class Body(object):
|
|
48 |
im = np.ascontiguousarray(im)
|
49 |
|
50 |
data = torch.from_numpy(im).float()
|
51 |
-
|
52 |
-
|
|
|
53 |
# data = data.permute([2, 0, 1]).unsqueeze(0).float()
|
54 |
with torch.no_grad():
|
55 |
Mconv7_stage6_L1, Mconv7_stage6_L2 = self.model(data)
|
|
|
16 |
from . import util
|
17 |
from .model import bodypose_model
|
18 |
|
19 |
+
import devicetorch
|
20 |
|
21 |
class Body(object):
|
22 |
def __init__(self, model_path):
|
|
|
49 |
im = np.ascontiguousarray(im)
|
50 |
|
51 |
data = torch.from_numpy(im).float()
|
52 |
+
data = devicetorch.to(torch, data)
|
53 |
+
# if torch.cuda.is_available():
|
54 |
+
# data = data.cuda()
|
55 |
# data = data.permute([2, 0, 1]).unsqueeze(0).float()
|
56 |
with torch.no_grad():
|
57 |
Mconv7_stage6_L1, Mconv7_stage6_L2 = self.model(data)
|