Comments (1)
The output avg_f
is not the accuracy of the model, but the average loss (cross entropy).
The following code should compute the accuracy
function common.test_epoch(opt, data_loader)
local net = opt.net or error('no net in test_epoch')
local criterion = opt.criterion or error('no criterion in test_epoch')
local n_batches = data_loader:n_batches()
net:evaluate()
local avg_f = 0
local accuracy = 0
local n_samples = 0
for batch_idx = 1, n_batches do
print(string.format('[INFO] test batch %d/%d', batch_idx, n_batches))
local timer = torch.Timer()
local input, target = data_loader:getBatch()
print(string.format('[INFO] loading data took %f[s] - n_batches %d', timer:time().real, target:size(1)))
local timer = torch.Timer()
local output = net:forward(input)
output = output[{{1,target:size(1)}, {}}]
local f = criterion:forward(output, target)
print(string.format('[INFO] net/crtrn fwd took %f[s]', timer:time().real))
avg_f = avg_f + f
local maxs, indices = torch.max(output, 2)
for bidx = 1, target:size(1) do
if indices[bidx][1] == target[bidx] then
accuracy = accuracy + 1
end
n_samples = n_samples + 1
end
end
avg_f = avg_f / n_batches
accuracy = accuracy / n_samples
print(string.format('test_epoch=%d, avg_f=%f, accuracy=%f', opt.epoch, avg_f, accuracy))
end
from octnet.
Related Issues (20)
- semantic segmentation task HOT 1
- has anyone begun to port this to pytorch? HOT 8
- Bad Argument to octree_resize_gpu
- How to read octree in python
- ..
- Error in Example 00_create_data (after successfully running example 01) HOT 6
- Segmentation
- BatchSize HOT 4
- Visualization Tools
- octree converted point clouds errors while training: Segmentation fault (core dumped) HOT 1
- Get Occupancy of an octree to be used to create a octree of different data HOT 2
- Can't run through the example.
- Can you provide some examples about the usage of the python and torch wrapper?
- How to properly visualize octree? HOT 5
- Is there function to convert octree back to dense volume?
- Remove an unnecessary null pointer check
- Can OctNet be applied on STL data type? HOT 1
- Issue with resolution and batch size HOT 2
- error when loading the octree data?? HOT 2
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 octnet.