taroii commited on
Commit
b5a3022
·
1 Parent(s): f837de1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -14,7 +14,9 @@ def anylize(img):
14
  inputs = processor(images=image, return_tensors="pt")
15
  outputs = model(**inputs)
16
 
17
- target_sizes = torch.tensor([image.size])
 
 
18
  results = processor.post_process_object_detection(outputs, target_sizes=target_sizes, threshold=0.9)[0]
19
 
20
  for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
 
14
  inputs = processor(images=image, return_tensors="pt")
15
  outputs = model(**inputs)
16
 
17
+ #target_sizes = torch.tensor([image.size])
18
+ #target_sizes = torch.tensor([image.size[::-1]])
19
+ target_sizes = torch.tensor([image.shape[:2]])
20
  results = processor.post_process_object_detection(outputs, target_sizes=target_sizes, threshold=0.9)[0]
21
 
22
  for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):