tianweiy / CenterPoint

MIT License
1.88k stars 456 forks source link

How to visualiaze loss values getting decreased during training? #3

Closed chowkamlee81 closed 4 years ago

chowkamlee81 commented 4 years ago

Is tensorboard is used to visualize since all are log files.

tianweiy commented 4 years ago

No, it is not used.

tianweiy commented 4 years ago

I just use the raw log to see the changes of the loss

tianweiy commented 4 years ago

Though you should be able to use tensorboard if you want. There is a tensorboard logger hook in det3d/torchie/trainer/hooks/logger/tensorboard.py. You need to adapt this file according to det3d/torchie/trainer/hooks/logger/text.py and change the config files.

chowkamlee81 commented 4 years ago

Thanks Ok

YznMur commented 3 years ago

I want to view the model as a graph in tensorboard using this command: writer = SummaryWriter() writer.add_graph(model, input) where I should insert this command ?

tianweiy commented 3 years ago

Hi, currently we can't use tensorboard to view the model as the input / output doesn't follow the predefined format (e.g. iterable). You can view the module through print. I remember @muzi2045 gets some graph visualization and it will be great if you(@muzi2045 ) can explain some simple way to do this.

chowkamlee81 commented 3 years ago

@YazanMurhij995 Kindly use onnx. Convert pytorch model to onnx format. You can easily visualize onnx file because already software s are there to view onnx files

YznMur commented 3 years ago

I tried but I am facing the same problem. it is not clear how to specify an input to the model! Can you give an example of the input please. It is something like Dict(voxels, num_points, num_voxels, coords, [grid_size])

YznMur commented 3 years ago

@chowkamlee81 , Have you managed to convert the model to onnx? it seems that the input format is not supported. Either the dict or np.ndarray should be changed. Can you tell me, please?

Qjizhi commented 3 years ago

@chowkamlee81 , Have you managed to convert the model to onnx? it seems that the input format is not supported. Either the dict or np.ndarray should be changed. Can you tell me, please?

@YazanMurhij995 Do you have any idea yet?

ChidanandKumarKS commented 3 years ago

loss_analysis.txt Attaching the code to visulaize loss values over a sequence of time. @YazanMurhij995 , @tianweiy Hope this solves analyzing loss visualization issues

YoushaaMurhij commented 3 years ago

@Qjizhi you can try to export some parts of the model (i,e neck or head) only! as the Dict format is not supported yet

Qjizhi commented 3 years ago

@Qjizhi you can try to export some parts of the model (i,e neck or head) only! as the Dict format is not supported yet

Hi @YoushaaMurhij, thanks for your reply, could you please share some open-sourced code?

YoushaaMurhij commented 3 years ago

Here are some instructions: https://pytorch.org/docs/stable/onnx.html you can apply it here (for example)

xavidzo commented 3 years ago

@Qjizhi you can try to export some parts of the model (i,e neck or head) only! as the Dict format is not supported yet

@YoushaaMurhij but if you change the inputs of the forward method of the reader, neck, and backbone to be lists instead of dictionaries, then the model could be exported as a whole easily to onnx? Can you answer please

YoushaaMurhij commented 3 years ago

@xavidzo Yes, It should be converted easily without problems. I didn't try that!

xavidzo commented 3 years ago

@xavidzo Yes, It should be converted easily without problems. I didn't try that!

Ok, thank you @YoushaaMurhij but if the output of the model, i.e. the output of the head is also a dictionary, would this work for onnx or should I also change the output to be a list as well?

I was also looking at the code of another repository where pointpillars was exported separately in two parts, the pfe and rpn.... but they did not export the PointPillarsScatter operation, they used for inference the PyTorch implementation of PointPillarsScatter without converting it... do you have maybe an idea why they did it this way? PointPillarsScatter should not be exported to onnx for some reason? https://github.com/SmallMunich/nutonomy_pointpillars/blob/68d3181d35702608d410e948608e9815815677b9/second/pytorch/tensorrt_onnx_infer.py#L63

YoushaaMurhij commented 3 years ago

I think it should work for the head, too. The problem with be only with the input part here.