Comments (4)
Hello @tejalal ,
The problem occurs because the comparison is waiting for scalars but when using ">" you receive a Boolean tensor. I had the same problem with the latest release of Pytorch. I solved it by creating a variable that saves the comparison as Booleans and creating another tensor where the type of data is changed to uint8.
condition = overlap[box] > max_overlap
condition = torch.tensor(condition, dtype=torch.uint8).to(device)
#print(torch.tensor(condition,dtype=torch.uint8))
suppress = torch.max(suppress, condition)
from a-pytorch-tutorial-to-object-detection.
Hello @tejalal ,
The problem occurs because the comparison is waiting for scalars but when using ">" you receive a Boolean tensor. I had the same problem with the latest release of Pytorch. I solved it by creating a variable that saves the comparison as Booleans and creating another tensor where the type of data is changed to uint8.condition = overlap[box] > max_overlap condition = torch.tensor(condition, dtype=torch.uint8).to(device) #print(torch.tensor(condition,dtype=torch.uint8)) suppress = torch.max(suppress, condition)
Hey @MartinEliasQ,
It gives UserWarning that uint8 is now deprecated, so I initialised suppress to torch.bool dtype and change following operation on suppress to logical operation. It gives no warning now.
suppress = torch.zeros((n_above_min_score)).bool().to(device) # (n_qualified)
# Consider each box in order of decreasing scores
for box in range(class_decoded_locs.size(0)):
# If this box is already marked for suppression
if suppress[box] == 1:
continue
# Suppress boxes whose overlaps (with this box) are greater than maximum overlap
# Find such boxes and update suppress indices
suppress = suppress | (overlap[box] > max_overlap)
# The max operation retains previously suppressed boxes, like an 'OR' operation
# Don't suppress this box, even though it has an overlap of 1 with itself
suppress[box] = 0
# Store only unsuppressed boxes for this class
image_boxes.append(class_decoded_locs[~suppress])
image_labels.append(
torch.LongTensor(
(~suppress).sum().item() * [c]).to(device)
)
image_scores.append(class_scores[~suppress])
from a-pytorch-tutorial-to-object-detection.
Hello @tejalal ,
The problem occurs because the comparison is waiting for scalars but when using ">" you receive a Boolean tensor. I had the same problem with the latest release of Pytorch. I solved it by creating a variable that saves the comparison as Booleans and creating another tensor where the type of data is changed to uint8.condition = overlap[box] > max_overlap condition = torch.tensor(condition, dtype=torch.uint8).to(device) #print(torch.tensor(condition,dtype=torch.uint8)) suppress = torch.max(suppress, condition)
Hey @MartinEliasQ I'm still getting the same error even after trying your solution. Any tips?
from a-pytorch-tutorial-to-object-detection.
@jackson211 Do you know how to solve this problem?
Traceback (most recent call last):
File "eval.py", line 141, in
evaluate(test_loader, model, test_img_num)
File "eval.py", line 87, in evaluate
top_k=200, original_image = images, max_OCR_overlap=0.2, max_OCR_ratio = 0.2)
File "/ctpn/sroie/sroie/task1/model.py", line 588, in detect_objects
[original_image.width, original_image.height, original_image.width,
AttributeError: 'Tensor' object has no attribute 'width'
from a-pytorch-tutorial-to-object-detection.
Related Issues (20)
- Wrong feature map size after conv7 in the picture
- What is the order of execution of programs
- in eval.py RuntimeError: legacy constructor expects device type: cpu but device type: cuda was passed
- Accuracy, precision, recall ,TF,FP,FN,TN
- gender classification
- How to use on custom dataset HOT 2
- Possible bug in the trained checkpoint?
- MultiBox Los Calculation
- broken .tar file with pretrained model
- classification layers arent training
- PredictionConvolutions separates locs and classes, doesn't follow the paper?
- Pre-trained model is not available HOT 2
- What if the x_min, y_min(or x_max, y_max) goes beyond (0, 1) when decoding gxgy to xy?
- question about MultiBoxLoss and the Model HOT 1
- FileNotFoundError: [Errno 2] No such file or directory: 'generator_checkpoint19.pth.tar'
- Can I use it for realtime or video
- prior box not clipped as expected HOT 12
- performence with not clipped prior boxes HOT 1
- mAP is 0
- ONNX model
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from a-pytorch-tutorial-to-object-detection.