lingtengqiu / Open-PIFuhd

This is an implementation of PIFuhd based on Pytorch
MIT License
347 stars 39 forks source link

关于渲染法线时应该选择哪个管线(train_pipeline or test_pipeline) #20

Closed sesveria closed 1 year ago

sesveria commented 1 year ago

问题是这样的: 我在使用bash ./scripts/generate.sh命令去渲染法线图时,注意到它的配置文件,即config文件夹下PIFuhd_Render_People_HG_normal_map.py有两种形式的法线生成配置,即train_pipelinetest_pipeline。当我使用test_pipeline时使用debug可以观察到与mask相对应的法线图,但当我使用train_pipeline时他们之间就不对应了。我想知道这是train过程中所需要的正常数据吗?还是说在渲染法线图时无论训练集还是测试集都应该使用test_pipeline来获得图像。(情况如下图)

正常情况,使用test_pipeline front 图一:front图像(test_pipeline)(上图) back 图二:back图像(test_pipeline)(上图) inside 图三:inside图像(test_pipeline)(上图) outside 图四:outside图像(test_pipeline)(上图)

貌似的异常情况,使用train_pipeline front 图一:front图像(train_pipeline)(上图) back 图二:back图像(train_pipeline)(上图) inside 图三:inside图像(train_pipeline)(上图) outside 图四:outside图像(train_pipeline)(上图)

在我使用小批量进行训练后,他们所得到的效果都不是很好,所以我无法判断到底哪个是对的 如果您可以帮我解答一下这个问题,我会非常感谢 我的邮箱:e21201067@stu.ahu.edu.cn

lingtengqiu commented 1 year ago

你的train_pipeline 应该是有些问题的,你是不是加入了offset (argumentation)或者其他什么argumentation, 你把对应的argumentation 先关一下,因为时间有些久了,具体我有些忘记了。

sesveria commented 1 year ago

非常感谢您的回复 我在生成法线图时使用的是原本的代码,没有改动 不过我使用数据集并不是renderpeople,可能会导致某些问题 一个非常大的变化就是模型的大小由原来的[(-128, 128), (-28, 228), (-128, 128)]变为了[(-1, 1), (-1, 1), (-1, 1)]

train_pipeline = [
    dict(type='img_pad'),dict(type='flip',flip_ratio=0.5),dict(type='scale'),dict(type='random_crop_trans'), 
    dict(type='color_jitter',brightness=0., contrast=0., saturation=0.0, hue=0.0,keys=['img']),dict(type='resize',size=(1024,1024),normal=False),
    dict(type='to_camera'),dict(type='ImageToTensor',keys=['img','mask']),dict(type='normalize',mean=[0.5,0.5,0.5],std=[0.5,0.5,0.5]),
    dict(type='ToTensor',keys=['calib','extrinsic']),
]

test_pipeline = [
    dict(type='resize',size=(1024,1024),normal =False),
    dict(type='to_camera'),
    dict(type='ImageToTensor',keys=['img','mask']),
    dict(type='normalize',mean=[0.5,0.5,0.5],std=[0.5,0.5,0.5]),
    dict(type='ToTensor',keys=['calib','extrinsic']),
]

我想问一下相比于test_pipeline,train_pipeline有什么格外的处理吗? 我试图调整pipeline来让它适应我的数据集 再次感谢您在百忙之中的回复

sesveria commented 1 year ago

我下载了一些RenderPeople模型,并以同样的方式得到了在train_pipeline下debug后的结果:

front 图一:front图像(上图) back 图二:back图像(上图) inside 图三:inside图像(上图) outside 图四:outside图像(上图)

我不知道哪里出了问题 希望得到您的回复

lingtengqiu commented 1 year ago

联系方式邮件你了

sesveria commented 1 year ago

该问题已解决 在渲染法线图时应该选择test_pipeline来生成法线 原因是train_pipeline包含了data agumentation,而这在法线渲染阶段是不需要的

lingtengqiu commented 1 year ago

该问题已解决 在渲染法线图时应该选择test_pipeline来生成法线 原因是train_pipeline包含了data agumentation,而这在法线渲染阶段是不需要的

Thanks for your explanations.

yangqinhui0423 commented 5 months ago

非常感谢您的回复 我在生成法线图时使用的是原本的代码,没有改动 不过我使用数据集并不是renderpeople,可能会导致某些问题 一个非常大的变化就是模型的大小由原来的[(-128, 128), (-28, 228), (-128, 128)]变为了[(-1, 1), (-1, 1), (-1, 1)]

train_pipeline = [
    dict(type='img_pad'),dict(type='flip',flip_ratio=0.5),dict(type='scale'),dict(type='random_crop_trans'), 
    dict(type='color_jitter',brightness=0., contrast=0., saturation=0.0, hue=0.0,keys=['img']),dict(type='resize',size=(1024,1024),normal=False),
    dict(type='to_camera'),dict(type='ImageToTensor',keys=['img','mask']),dict(type='normalize',mean=[0.5,0.5,0.5],std=[0.5,0.5,0.5]),
    dict(type='ToTensor',keys=['calib','extrinsic']),
]

test_pipeline = [
    dict(type='resize',size=(1024,1024),normal =False),
    dict(type='to_camera'),
    dict(type='ImageToTensor',keys=['img','mask']),
    dict(type='normalize',mean=[0.5,0.5,0.5],std=[0.5,0.5,0.5]),
    dict(type='ToTensor',keys=['calib','extrinsic']),
]

我想问一下相比于test_pipeline,train_pipeline有什么格外的处理吗? 我试图调整pipeline来让它适应我的数据集 再次感谢您在百忙之中的回复

Hello, I wonder if you use the dataset Thuman2.0. I met some confusion when run the fine training order. I changed the rect as you mentioned here : __B_MIN = np.array([-1, -1, -1]) __B_MAX = np.array([1, 1, 1]) And after fine training, I only get the results of the lower half of the human body. (When I finished coarse training, I can get the whole human body.) 2024-04-01 18-07-54 的屏幕截图 Could you please tell me whether there are any other things to change?

sesveria commented 5 months ago

@yangqinhui0423 Perhaps you should check the range of your Thuman training model. I have set them to [-1,1] for all axes (x, y, z), and maybe your range is [-0.5, 0.5] or something else. You can also try to change the B-MIN and B-MAX to achieve the desired effect.

yangqinhui0423 commented 5 months ago

@yangqinhui0423 Perhaps you should check the range of your Thuman training model. I have set them to [-1,1] for all axes (x, y, z), and maybe your range is [-0.5, 0.5] or something else. You can also try to change the B-MIN and B-MAX to achieve the desired effect.

感谢您的回复。请问你是如何把(x,y,z)轴设置在(-1,1)之间呢?或者说我该如何确认我的数据集的range呢?

我现在是直接在采样的时候把sigma设置为0.005cm和0.003cm, 并且把原来的

__B_MIN = np.array([-128, -28, -128])

__B_MAX = np.array([128, 228, 128])#数据集中有效样本区域的最小边界和最大边界

修改为 __B_MIN = np.array([-1, -1, -1]) __B_MAX = np.array([1, 1, 1]) 然后进行训练,我的coarse训练没有问题,fine训练出了问题(训练得到的.ply文件是上半身或者下半身),所以我比较困惑问题出在了哪里。 补充说明:我还没有完整的完成训练(设置了epoch=12),以人体数据集的其中一个为例,我在fine训练的第一个epoch得到的是上半身,第6个epoch得到的是下半身。但是另一个就是每个epoch得到的都是下半身,结果很随机。还是说这是因为我没有完成整个训练的缘故呢?

2024-04-01 20-23-02 的屏幕截图 从这个.ply文件看,我感觉是某个边界的设置出了问题,但我不知道该如何准确定位。盼解答!

sesveria commented 5 months ago

@yangqinhui0423 你可以先检查一下你的训练用模型,据我所知,如果你是从官方渠道下载的Thuman2.0,它的模型很多模型大小都是不一样的,需要重新调整一下。