Comments (6)
Hi,
If I understand correctly, you are trying to use the metrics
for Trainer
? It is an old piece of code I borrowed from my other projects, so it may be confusing to use.
An example of a metric class can be:
class ROCMeter:
def __init__(self):
self.truths = []
self.preds = []
def clear(self):
self.truths = []
self.preds = []
def prepare_inputs(self, *inputs):
outputs = []
for i, inp in enumerate(inputs):
if torch.is_tensor(inp):
inp = inp.detach().cpu().numpy()
outputs.append(inp)
return outputs
def update(self, preds, truths):
# [B, ], [B, ]
preds, truths = self.prepare_inputs(preds, truths)
self.truths.append(truths)
self.preds.append(preds)
def measure(self):
return roc_auc_score(np.concatenate(self.truths, 0), np.concatenate(self.preds, 0))
def write(self, writer, global_step, prefix=""):
writer.add_scalar(os.path.join(prefix, "roc"), self.measure(), global_step)
def report(self):
return f'ROC = {self.measure():.6f}'
and used like:
trainer = Trainer(..., metrics=[ROCMeter(),], ...)
I will add a PSNR metric recently.
from torch-ngp.
Thank you sooo much! I'll try to implement that. Moreover, can you explain in SDF why are you using the negative sign here? sdfs[self.num_samples // 2:] = -self.sdf_fn(points[self.num_samples // 2:])[:,None].astype(np.float32)
from torch-ngp.
@JoyHighmore I have added the PSNR metric, you can try now!
As for the sdf value, it is just a convention (inner is negative, outer is positive), without the negation it should also work since we extract surface at sdf == 0
.
(Besides, I find that the PSNR for lego is still worse compared to the original implementation, and I'll try to figure it out. If you find any problem, welcome to report!)
from torch-ngp.
Sure, there is one more thing that I'd like to discuss. I've noticed that there are some code trying to calculate the sdf by igl.signed_distance. I've also implement both igl and pysdf. It is found that they had quite different results, which not only with the different values but also different indications for inside and outside categories. Do you have any thoughts? What's your consideration for the pysdf? Also, are you trying to have balanced positive and negative sdf since you are using self.num_samples // 2 in this equation?
Best,
Joy
from torch-ngp.
@JoyHighmore That's strange, the SDF value should be unique as long as the mesh is fixed. Inside/Outside doesn't really matter as the only difference is a negation.
In fact the pos/neg points are not balanced, I followed the original implementation to sample 1/8 random points, 3/8 surface points, and 4/8 perturbed surface points.
from torch-ngp.
closed for now.
from torch-ngp.
Related Issues (20)
- GridEncoder can't handle empty positions
- hi, I have some questions when using 'test' mode after trained a model with custom data
- The value of `self.cascade` becomes 0 when `bound <= 0.5`, causing errors
- Interpolation in GridEncoder might be wrong? HOT 1
- Control Time in GUI for D-NeRF HOT 1
- Hi. I had a question about the dataloading step. Why does all the data need to be loaded in a single step. I am running out of GPU memory. Is it possible to do it in batches.
- Ambient Occlusion (AO) using the (Instant-NGP framework)
- fail to rebuild radiance field. such as fox, lego HOT 1
- ModuleNotFoundError: No module named '_raymarching' HOT 8
- OK. Thank you for your response!
- About environments! HOT 1
- ImportError: No module named '_hash_encoder'
- About GUI
- issues when build extensions:ERROR: Could not build wheels for raymarching, which is required to install pyproject.toml-based projects HOT 1
- CUDA 12
- D-NeRF does not perform well when running the HyperNeRF data set. Does it need to make some adjustments?
- A tip to use smpl camera data to use with torch-ngp? Which transformation do we use?
- build extension problem HOT 1
- This is strange, I haven't met this problem. Could you try to install some other packages that require building extensions? For example, `pip install torch-scatter` following [this](https://github.com/rusty1s/pytorch_scatter#from-source)?
- The growth process of `local_step` seems to have an issue.
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 torch-ngp.