Comments (4)
I found that the number of linear iterations and whether to use preconditioner means a lot to the convergence. Reducing nLinearIterations from 10 to 3 and disable preconditioner can make Opt work on the sfs example.
from opt.
What version of terra are you using?
This is a problem, the default parameters should work fine. For the LM solver, what happens if you set the residual_reset_period to 1?
from opt.
Thanks for your reply. My terra is cloned from its github master branch, built from source with LLVM 6.0.1 and VS2015. I tried setting residual_reset_period to 1, but OptLM still reverts every iteration.
virtual void combinedSolveInit() override {
m_solverParams.set("nIterations", &m_combinedSolverParameters.nonLinearIter);
m_solverParams.set("lIterations", &m_combinedSolverParameters.linearIter);
m_solverParams.set("residual_reset_period", &m_combinedSolverParameters.residual_reset_period);
}
...
struct CombinedSolverParameters {
bool useCUDA = false;
bool useOpt = true;
bool useOptLM = false;
bool useCeres = false;
bool earlyOut = false;
unsigned int numIter = 1;
unsigned int nonLinearIter = 3;
unsigned int linearIter = 200;
unsigned int patchIter = 32;
bool profileSolve = true;
bool optDoublePrecision = false;
float residual_reset_period = 1;
};
And here is the output.
Saving targetDepth 640x480x1
Num Active Unknowns: 192162
1 weight
100 fit
100 reg
Saving targetIntensity.png 640x480x1
Saving targetDepth 640x480x1
Saving maskEdgeMap.png 640x960x1
Saving maskEdgeMap 640x960x1
Num Active Unknowns: 192162
1 weight
100 fit
100 reg
Saving sfsInitDepth.ply 640x480x1
warning: Linking two modules of different data layouts: 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0/nvvm/libdevice/libdevice.10.bc' is '' whereas 'external' is 'e-m:w-i64:64-f80:128-n8:16:32:64-S128'
Using Opt v0.2.2
nUnknowns = 307200
nResiduals = 0 + 307200 * 6
nnz = 0 + 307200 * 26
compile time: 4.1668634786038
problem plan complete
GPU memory usage: used = 2142.637501, free = 9121.362499 MB, total = 11264.000000 MB
22524.102539063
Solving
//////////// (Opt(LM)) ///////////////
cost=175.765216
model_cost=22708265.595070
model_cost_change=-22708089.829853
trust_region_radius=5000.000000
REVERT
cost=175.765216
model_cost=22708265.612590
model_cost_change=-22708089.847374
trust_region_radius=1250.000000
REVERT
cost=175.765216
model_cost=22708265.717455
model_cost_change=-22708089.952239
trust_region_radius=156.250000
REVERT
cost=175.765216
model_cost=22708266.675104
model_cost_change=-22708090.909887
trust_region_radius=9.765625
REVERT
cost=175.765216
model_cost=22708278.340151
model_cost_change=-22708102.574935
trust_region_radius=0.305176
REVERT
cost=175.765216
model_cost=22708241.150293
model_cost_change=-22708065.385077
trust_region_radius=0.004768
REVERT
zeta=1.6423318817270691e-005, breaking at iteration: 2
cost=175.765216
model_cost=22708195.599687
model_cost_change=-22708019.834471
trust_region_radius=0.000037
REVERT
zeta=1.0141227687073646e-009, breaking at iteration: 2
cost=175.765216
model_cost=22708194.554962
model_cost_change=-22708018.789745
trust_region_radius=0.000000
REVERT
zeta=1.4936715456057726e-014, breaking at iteration: 2
cost=175.765216
model_cost=22708194.546709
model_cost_change=-22708018.781492
trust_region_radius=0.000000
REVERT
zeta=-3.6332546053598101e-015, breaking at iteration: 2
cost=175.765216
model_cost=22708194.546677
model_cost_change=-22708018.781460
trust_region_radius=0.000000
REVERT
zeta=0, breaking at iteration: 2
cost=175.765216
model_cost=22708194.546676
model_cost_change=-22708018.781460
trust_region_radius=0.000000
REVERT
zeta=-4.0369495604115869e-016, breaking at iteration: 2
cost=175.765216
model_cost=22708194.546676
model_cost_change=-22708018.781460
trust_region_radius=0.000000
REVERT
zeta=0, breaking at iteration: 2
cost=175.765216
model_cost=22708194.546676
model_cost_change=-22708018.781460
trust_region_radius=0.000000
REVERT
zeta=4.036949560411584e-016, breaking at iteration: 2
cost=175.765216
model_cost=22708194.546676
model_cost_change=-22708018.781460
trust_region_radius=0.000000
REVERT
zeta=1.2110848681234751e-015, breaking at iteration: 2
cost=175.765216
model_cost=22708194.546676
model_cost_change=-22708018.781460
trust_region_radius=0.000000
Trust_region_radius is less than the min, exiting
final cost=175.765216
--------------------------------------------------------
Kernel | Count | Total | Average
----------------------+----------+-----------+----------
----------------------+----------+-----------+----------
overall | 1 | 313.555ms| 313.5549ms
----------------------+----------+-----------+----------
precompute_W_H | 30 | 26.998ms| 0.8999ms
----------------------+----------+-----------+----------
computeCost_W_H | 16 | 6.909ms| 0.4318ms
----------------------+----------+-----------+----------
PCGInit1_W_H | 15 | 31.470ms| 2.0980ms
----------------------+----------+-----------+----------
PCGSaveSSq_W_H | 1 | 1.077ms| 1.0773ms
----------------------+----------+-----------+----------
PCGComputeCtC_W_H | 15 | 16.487ms| 1.0991ms
----------------------+----------+-----------+----------
PCGFinalizeDiagonal_W_H | 15 | 16.556ms| 1.1037ms
----------------------+----------+-----------+----------
PCGStep1_W_H | 36 | 41.774ms| 1.1604ms
----------------------+----------+-----------+----------
PCGStep2_W_H | 36 | 39.746ms| 1.1041ms
----------------------+----------+-----------+----------
PCGStep3_W_H | 36 | 37.802ms| 1.0501ms
----------------------+----------+-----------+----------
computeModelCost_W_H | 15 | 7.849ms| 0.5233ms
----------------------+----------+-----------+----------
savePreviousUnknowns_W_H | 15 | 15.594ms| 1.0396ms
----------------------+----------+-----------+----------
PCGLinearUpdate_W_H | 15 | 15.675ms| 1.0450ms
----------------------+----------+-----------+----------
revertUpdate_W_H | 15 | 15.611ms| 1.0407ms
--------------------------------------------------------
TIMING 313.554932 31.469507 41.774025
Per-iter times ms (nonlinear,linear): 119.2413 119.3221
===Shape From Shading===
**Final Costs**
Opt GN,Opt LM,CERES
,1.75765216273377006928e+02,
Solved
About to save
Saving sfsOutput 640x480x1
Saving sfsOutput.ply 640x480x1
Save
GPU memory usage: used = 2117.512501, free = 9146.487499 MB, total = 11264.000000 MB
plan free complete
GPU memory usage: used = 2117.512501, free = 9146.487499 MB, total = 11264.000000 MB
from opt.
Also I don't understand why when I enable preconditioner or increase nLinearIteration, the loss increases and solution drifts. Is there anything underlining mathematical principle of PCG algorithm?
from opt.
Related Issues (20)
- CUDA 10 got a different path for libdevice HOT 13
- how to build, is there a cmake solution HOT 1
- Support running Opt on non default cudaStream HOT 1
- Opt examples run significantly slower than CUDA solver HOT 5
- src/terralib.lua:4034: error loading terra module ad from file ../Opt/API/src/ad.t: not enough memory HOT 1
- Indexing images at calculated offset HOT 2
- Is the "Index" function implemented correctly? HOT 1
- "cuda reported error 500" when compute the albedo map in "shape_from_shading" using Graph HOT 1
- Ability to have meshes with boundaries
- Proposition / discussion about introducing hashing data structure support
- Dense image inverse warping HOT 2
- Windows 10: Slow performance in imageWrapping example with different Terra version HOT 1
- Help with robust_nonrigid_alignment
- Can't work with CUDA 10.1 ?
- A problem when compiled with CUDA11.1 and RTX 3090 HOT 3
- Global variable 'cudalib' is not declared.
- llvm: Invalid value
- Arap mesh deformation strange result HOT 1
- How to build Opt on Windows 10 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 opt.