Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

images/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# PyTorch weights
*.tar
*.pth
*.gz
Untitled.ipynb
Testing notebook.ipynb
5 changes: 3 additions & 2 deletions image_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

def main():
model = posenet.load_model(args.model)
model = model.cuda()
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = model.to(device=device)
output_stride = model.output_stride

if args.output_dir:
Expand All @@ -34,7 +35,7 @@ def main():
f, scale_factor=args.scale_factor, output_stride=output_stride)

with torch.no_grad():
input_image = torch.Tensor(input_image).cuda()
input_image = torch.Tensor(input_image).to(device=device)

heatmaps_result, offsets_result, displacement_fwd_result, displacement_bwd_result = model(input_image)

Expand Down
7 changes: 4 additions & 3 deletions webcam_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

def main():
model = posenet.load_model(args.model)
model = model.cuda()
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = model.to(device=device)
output_stride = model.output_stride

cap = cv2.VideoCapture(args.cam_id)
Expand All @@ -30,7 +31,7 @@ def main():
cap, scale_factor=args.scale_factor, output_stride=output_stride)

with torch.no_grad():
input_image = torch.Tensor(input_image).cuda()
input_image = torch.Tensor(input_image).to(device=device)

heatmaps_result, offsets_result, displacement_fwd_result, displacement_bwd_result = model(input_image)

Expand Down Expand Up @@ -59,4 +60,4 @@ def main():


if __name__ == "__main__":
main()
main()