lsc-cnn
lsc-cnn copied to clipboard
How do I predict with a picture of myself?
There is no. Mat file in my own picture, so I removed the second path in 'paths', but there was an error next!
‘’‘
Traceback (most recent call last):
File "main.py", line 1098, in
I think that there is not a dedicated script for the prediction task. Can the authors provide us a script that accomplishes this task or at least give us some instructions to create it and contribute to the project ?
Hello,
I'm in the process of adding this feature, but for the time being, you can keep the .mat
file as is and put your image in the images
folder and dump the dataset and then test according to the instructions given in the README.md
.
Let me know if you run into problems with this hack.
You can try to use my fork : https://github.com/vlad3996/lsc-cnn
@vlad3996 not working.can you tell me what weights and what needs to be done,i get fllowing error -
RuntimeError: Error(s) in loading state_dict for LSCCNN: Missing key(s) in state_dict: "conv1_1.weight", "conv1_1.bias", "conv1_2.weight", "conv1_2.bias", "conv2_1.weight", "conv2_1.bias", "conv2_2.weight", "conv2_2.bias", "conv3_1.weight", "conv3_1.bias", "conv3_2.weight", "conv3_2.bias", "conv3_3.weight", "conv3_3.bias", "conv4_1.weight", "conv4_1.bias", "conv4_2.weight", "conv4_2.bias", "conv4_3.weight", "conv4_3.bias", "conv5_1.weight", "conv5_1.bias", "conv5_2.weight", "conv5_2.bias", "conv5_3.weight", "conv5_3.bias", "convA_1.weight", "convA_1.bias", "convA_2.weight", "convA_2.bias", "convA_3.weight", "convA_3.bias", "convA_4.weight", "convA_4.bias", "convA_5.weight", "convA_5.bias", "convB_1.weight", "convB_1.bias", "convB_2.weight", "convB_2.bias", "convB_3.weight", "convB_3.bias", "convB_4.weight", "convB_4.bias", "convB_5.weight", "convB_5.bias", "convC_1.weight", "convC_1.bias", "convC_2.weight", "convC_2.bias", "convC_3.weight", "convC_3.bias", "convC_4.weight", "convC_4.bias", "convC_5.weight", "convC_5.bias", "convD_1.weight", "convD_1.bias", "convD_2.weight", "convD_2.bias", "convD_3.weight", "convD_3.bias", "convD_4.weight", "convD_4.bias", "convD_5.weight", "convD_5.bias", "conv_before_transpose_1.weight", "conv_before_transpose_1.bias", "transpose_1.weight", "transpose_1.bias", "conv_after_transpose_1_1.weight", "conv_after_transpose_1_1.bias", "transpose_2.weight", "transpose_2.bias", "conv_after_transpose_2_1.weight", "conv_after_transpose_2_1.bias", "transpose_3.weight", "transpose_3.bias", "conv_after_transpose_3_1.weight", "conv_after_transpose_3_1.bias", "transpose_4_1_a.weight", "transpose_4_1_a.bias", "transpose_4_1_b.weight", "transpose_4_1_b.bias", "conv_after_transpose_4_1.weight", "conv_after_transpose_4_1.bias", "transpose_4_2.weight", "transpose_4_2.bias", "conv_after_transpose_4_2.weight", "conv_after_transpose_4_2.bias", "transpose_4_3.weight", "transpose_4_3.bias", "conv_after_transpose_4_3.weight", "conv_after_transpose_4_3.bias", "conv_middle_1.weight", "conv_middle_1.bias", "conv_middle_2.weight", "conv_middle_2.bias", "conv_middle_3.weight", "conv_middle_3.bias", "conv_mid_4.weight", "conv_mid_4.bias", "conv_lowest_1.weight", "conv_lowest_1.bias", "conv_lowest_2.weight", "conv_lowest_2.bias", "conv_lowest_3.weight", "conv_lowest_3.bias", "conv_lowest_4.weight", "conv_lowest_4.bias", "conv_scale1_1.weight", "conv_scale1_1.bias", "conv_scale1_2.weight", "conv_scale1_2.bias", "conv_scale1_3.weight", "conv_scale1_3.bias". Unexpected key(s) in state_dict: "epoch", "state_dict", "optimizer".
after downlaoding wieghts mentioned in your readme -
out = self.forward(torch.from_numpy(image.transpose((2, 0, 1)).astype(np.float32)).unsqueeze(0).cuda()) File "/home/jbasmsdsdai/Downloads/lsc-cnn-master/model.py", line 140, in forward sub1_concat = torch.cat((sub1_out_conv1, sub1_after_transpose_1), dim=1) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 74 and 75 in dimension 2 at /opt/conda/conda-bld/pytorch_1556653215914/work/aten/src/THC/generic/THCTensorMath.cu:71
@learnermaxRL the problem is with input image shape : it must be divisible by 16 because author concatenate feature maps from 3rd pooling layer and upsampled by nn.ConvTranspose2d maps from 4th pooling layer, which can not match by shape.
If people are interested, i wrote some code to port the existing .pth weights into a keras version of the model, although it doesnt support batch predictions for now, only one, and i used the same NMS approach used in this repository, but if your goal is to just do prediction, it can be used
Example of using the detection from the model is also supplied
@learnermaxRL the problem is with input image shape : it must be divisible by 16 because author concatenate feature maps from 3rd pooling layer and upsampled by nn.ConvTranspose2d maps from 4th pooling layer, which can not match by shape.
You can try to use my fork : https://github.com/vlad3996/lsc-cnn
How to train other dataset in you fork?
You can try to use my fork : https://github.com/vlad3996/lsc-cnn
How do I get the count of people ? Does it return somewhere ?
You can try to use my fork : https://github.com/vlad3996/lsc-cnn
How do I get the count of people ? Does it return somewhere ?
it is easily achievable by getting the length of the resulting array of detections
You can try to use my fork : https://github.com/vlad3996/lsc-cnn
this is my test result ,why
@vlad3996 not working.can you tell me what weights and what needs to be done,i get fllowing error -
RuntimeError: Error(s) in loading state_dict for LSCCNN: Missing key(s) in state_dict: "conv1_1.weight", "conv1_1.bias", "conv1_2.weight", "conv1_2.bias", "conv2_1.weight", "conv2_1.bias", "conv2_2.weight", "conv2_2.bias", "conv3_1.weight", "conv3_1.bias", "conv3_2.weight", "conv3_2.bias", "conv3_3.weight", "conv3_3.bias", "conv4_1.weight", "conv4_1.bias", "conv4_2.weight", "conv4_2.bias", "conv4_3.weight", "conv4_3.bias", "conv5_1.weight", "conv5_1.bias", "conv5_2.weight", "conv5_2.bias", "conv5_3.weight", "conv5_3.bias", "convA_1.weight", "convA_1.bias", "convA_2.weight", "convA_2.bias", "convA_3.weight", "convA_3.bias", "convA_4.weight", "convA_4.bias", "convA_5.weight", "convA_5.bias", "convB_1.weight", "convB_1.bias", "convB_2.weight", "convB_2.bias", "convB_3.weight", "convB_3.bias", "convB_4.weight", "convB_4.bias", "convB_5.weight", "convB_5.bias", "convC_1.weight", "convC_1.bias", "convC_2.weight", "convC_2.bias", "convC_3.weight", "convC_3.bias", "convC_4.weight", "convC_4.bias", "convC_5.weight", "convC_5.bias", "convD_1.weight", "convD_1.bias", "convD_2.weight", "convD_2.bias", "convD_3.weight", "convD_3.bias", "convD_4.weight", "convD_4.bias", "convD_5.weight", "convD_5.bias", "conv_before_transpose_1.weight", "conv_before_transpose_1.bias", "transpose_1.weight", "transpose_1.bias", "conv_after_transpose_1_1.weight", "conv_after_transpose_1_1.bias", "transpose_2.weight", "transpose_2.bias", "conv_after_transpose_2_1.weight", "conv_after_transpose_2_1.bias", "transpose_3.weight", "transpose_3.bias", "conv_after_transpose_3_1.weight", "conv_after_transpose_3_1.bias", "transpose_4_1_a.weight", "transpose_4_1_a.bias", "transpose_4_1_b.weight", "transpose_4_1_b.bias", "conv_after_transpose_4_1.weight", "conv_after_transpose_4_1.bias", "transpose_4_2.weight", "transpose_4_2.bias", "conv_after_transpose_4_2.weight", "conv_after_transpose_4_2.bias", "transpose_4_3.weight", "transpose_4_3.bias", "conv_after_transpose_4_3.weight", "conv_after_transpose_4_3.bias", "conv_middle_1.weight", "conv_middle_1.bias", "conv_middle_2.weight", "conv_middle_2.bias", "conv_middle_3.weight", "conv_middle_3.bias", "conv_mid_4.weight", "conv_mid_4.bias", "conv_lowest_1.weight", "conv_lowest_1.bias", "conv_lowest_2.weight", "conv_lowest_2.bias", "conv_lowest_3.weight", "conv_lowest_3.bias", "conv_lowest_4.weight", "conv_lowest_4.bias", "conv_scale1_1.weight", "conv_scale1_1.bias", "conv_scale1_2.weight", "conv_scale1_2.bias", "conv_scale1_3.weight", "conv_scale1_3.bias". Unexpected key(s) in state_dict: "epoch", "state_dict", "optimizer".
@learnermaxRL how did you fix the error you were experiencing?
@kaamlaS add model.load_state_dict(checkpoint['state_dict'], strict=False)
to line 107 in model.py
You can try to use my fork : https://github.com/vlad3996/lsc-cnn
this is my test result ,why
@knightyxp Did you manage to get better results from this?