Comments (2)
Hi,
I tried to execute the demo command on README and get the below errors:python demo.py --input images/101027.jpg Traceback (most recent call last): File "demo.py", line 118, in <module> print (batch_idx, '/', args.maxIter, ':', nLabels, loss.data[0]) IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
I'm not familiar with tensor though. Could you please suggest how to modify the code to solve this problem?
My system is Windows 10. Python version 3.7.3. PyTorch==1.2+cpu, opencv-python==4.1.1.26, scikit-image==0.15.0.
I had this same issue and I found that it happened because of PyTorch version. Mine is 1.2.0.
In demo.py you can find:
print (batch_idx, '/', args.maxIter, ':', nLabels, loss.data[0])
# for pytorch 1.0
#print (batch_idx, '/', args.maxIter, ':', nLabels, loss.item())
So what worked for me was to comment line 118 and uncomment line 121 - #print (batch_idx, '/', args.maxIter, ':', nLabels, loss.item())
from pytorch-unsupervised-segmentation.
I uncommented that line now. Thanks @dallaqua!
from pytorch-unsupervised-segmentation.
Related Issues (12)
- a bug? HOT 3
- How can we specify the segmentation class number? HOT 2
- Training & Saving Model HOT 1
- Can this segmentation be extended for 3D images? HOT 1
- Precision-recall curve
- a problem about about FCN
- Why is the same color getting assigned to different regions of the an image? HOT 5
- Inappropriate results HOT 4
- Configuration for best average precision score HOT 1
- deleted
- Need scikit-image as dependency HOT 1
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 pytorch-unsupervised-segmentation.