Coder Social home page Coder Social logo

taohan10200 / iim Goto Github PK

View Code? Open in Web Editor NEW
162.0 8.0 39.0 12.59 MB

PyTorch implementations of the paper: "Learning Independent Instance Maps for Crowd Localization"

License: MIT License

Python 100.00%
crowd-localization crowd-counting crowd-analysis

iim's Introduction

👋Hello , I am Tao Han ✨.

🤝🏻  Connect with Me

Email    HomePage

- 👯 I’m looking to collaborate on Large Weather Model (LWM) and Ai4Science. Please feel free to drop me if you are interested in this topic.

iim's People

Contributors

gjy3035 avatar taohan10200 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iim's Issues

关于读取模型权重的问题

@taohan10200 ,作者你好,我按照readme的训练过程指导在NWPU数据集上迭代训练时,模型按要求这样保存与加载,但预测出来的像素点始终是0。
image
image
image
使用你提供的权重,上述模型加载方式就没有问题,调试也没能找到方向,可否麻烦你帮忙看看,感谢。
image

OOM

x[i] = self.branches[i](x[i])

File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/container.py", line 117, in forward
input = module(input)
File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/ai/lixinagss/IIM/model/HR_Net/seg_hrnet.py", line 50, in forward
out = self.bn1(out)
File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/batchnorm.py", line 136, in forward
self.weight, self.bias, bn_training, exponential_average_factor, self.eps)
File "/opt/conda/lib/python3.7/site-packages/torch/nn/functional.py", line 2016, in batch_norm
training, momentum, eps, torch.backends.cudnn.enabled
File "/opt/conda/lib/python3.7/site-packages/torch/utils/data/_utils/signal_handling.py", line 66, in handler
_error_if_any_worker_fails()
RuntimeError: DataLoader worker (pid 1108) is killed by signal: Bus error. It is possible that dataloader's workers are out of shared memory. Please try to raise your shared memory limit.

I train the NWPU,the batch is 1, __C_NWPU.TRAIN_BATCH_SIZE = 12 #imgs
still OOM. on one 11G ..

模型保存为pt时报错RuntimeError: Could not export Python function call 'BinarizedF'

您好,在尝试使用torch.jit.trace保存为pt模型文件时
traced_script_module = torch.jit.trace(net,torch.rand(1, 3, 224, 224))
traced_script_module.save("modelIIMX.pt")
报如下错误:
Traceback (most recent call last):
File "gpt.py", line 28, in
torch.jit.save(model,"modelIIMX.pt")
File "/home/wjq/anaconda3/envs/IIM/lib/python3.7/site-packages/torch/jit/_serialization.py", line 81, in save
m.save(f, _extra_files=_extra_files)
File "/home/wjq/anaconda3/envs/IIM/lib/python3.7/site-packages/torch/jit/_script.py", line 490, in save
return self._c.save(str(f), **kwargs)
RuntimeError:
Could not export Python function call 'BinarizedF'. Remove calls to Python functions before export. Did you forget to add @script or @script_method annotation? If this is a nn.ModuleList, add it to constants:
/home/wjq/IIM/IIM-main/model/PBM.py(77): forward
/home/wjq/anaconda3/envs/IIM/lib/python3.7/site-packages/torch/nn/modules/module.py(860): _slow_forward
/home/wjq/anaconda3/envs/IIM/lib/python3.7/site-packages/torch/nn/modules/module.py(887): _call_impl
/home/wjq/IIM/IIM-main/model/locator.py(39): forward
/home/wjq/anaconda3/envs/IIM/lib/python3.7/site-packages/torch/nn/modules/module.py(860): _slow_forward
/home/wjq/anaconda3/envs/IIM/lib/python3.7/site-packages/torch/nn/modules/module.py(887): _call_impl
/home/wjq/anaconda3/envs/IIM/lib/python3.7/site-packages/torch/jit/_trace.py(940): trace_module
/home/wjq/anaconda3/envs/IIM/lib/python3.7/site-packages/torch/jit/_trace.py(742): trace
gpt.py(27):
尝试了一些方法仍未解决,麻烦有空帮忙看下要如何解决,谢谢

net.load_state_dict(new_state_dict,False)

size mismatch for Binar.Threshold_Module.0.weight: copying a param with shape torch.Size([256, 768, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 720, 3, 3]).

why?

Memory allocation error

Hello @taohan10200, I tried to use this framework on the custom dataset and I get the below error in trainer.py

crop_imgs, crop_gt, crop_masks = map(lambda x: torch.cat(x, dim=0), (crop_imgs, crop_gt, crop_masks))

image

Any workaround to solve this? I use a 40GB RAM to do this training

Confidence level?

Hi! Thanks for the wonderful repo for head detecting and counting people.

I'm wondering other than position of the head location detected, is it possible to also get any confidence level or probability map?

关于源码里面BinarizedF的反传部分的疑惑

class BinarizedF(Function):
  @staticmethod
  def forward(ctx, input, threshold):
    # 预测pred_map 阈值T 
    ctx.save_for_backward(input,threshold)
    a = torch.ones_like(input).cuda()
    b = torch.zeros_like(input).cuda()
    output = torch.where(input>=threshold,a,b)
    return output  # out = 

  @staticmethod
  def backward(ctx, grad_output):
    # print('grad_output',grad_output)  这个参数默认是全 1  
    input,threshold = ctx.saved_tensors
    grad_input = grad_weight  = None

    if ctx.needs_input_grad[0]:
      grad_input= 0.2*grad_output  # 对pred的梯度
    if ctx.needs_input_grad[1]:
      grad_weight = -grad_output   # 对T的导数是 -1
    return grad_input, grad_weight

作者您好,这篇论文效果很棒,感谢你们的工作。
但是对于源码里,BF这个部分。为什么grad_input= 0.2*grad_output。这个0.2是人为设定的吗,还是从哪里推导出来的呢。 在论文中,我也没有看的很明白。感谢您的解答。

Great work but Threshold Encoder module is useless.Details look at the picture

Thanks for the author's work.Great work!!!!!
1:Working so hard to train the Threshold Encoder which aim is to seperate the pred_map(the output of the network) to 1 or 0, but there is little differences between the pred_map after processed by the Threshold Encoder and the pred_map without processed by the Threshold Encoder.Details can look at the picture
微信图片_20211011153600
微信图片_20211011153606
微信图片_20211011153613

Can you share the codes for generating GT IIMs?

Hi there, thanks for this impressive work! I am interested in trying it out on my own counting dataset which uses a point level annotation. Can you share the script for getting the IIM maps from points or dot maps? Thanks very much!

Congratulations on this amazing work!

训练时有足够内存,依然得到out of memory问题

您好,首先感谢您分享了您的稠密目标定位算法,最近我对您得算法进行实现得时候出现了问题,如下:
首先我是在windows10平台上运行得训练过程,前面数据和模型处理好了以后,开始训练出现问题如下:
不论运行那个模型,当模型开始正向执行,总是在第一个conv出爆出问题:
VGG16_FPN.py:
def forward(self, x):
f = []
x = self.layer1(x)
seg_hrnet.py:
def forward(self, x):
residual = x
out = self.conv1(x)
总是爆出内存不足问题,
RuntimeError: CUDA out of memory. Tried to allocate 4.50 GiB (GPU 0; 12.00 GiB total capacity; 886.66 MiB already allocated; 5.14 GiB free; 4.94 GiB reserved in total by PyTorch)
但是其中它想去分配4.5G,(Tried to allocate 4.50 GiB),而我的电脑除了pytorch占用得,还有5G(5.14 GiB free; 4.94 GiB reserved in total by PyTorch).
目前不知道是哪里除了问题,请问您原始代码是在那个平台训练得,ubuntu吗?或者您这边有什么思路可以解决此问题吗?
期待您得回复,万分感谢!

the weights of Threshold Encoder be NaN when training

Hello, your work is interesting and inspired. I'm trying to re-implement your paper using keras, but the weights of threshold encoder would be nan after some epochs. Have this phenomenon happened to you, or could you give some suggestions?

thank you~

数据集

下载的数据集解压不了是为什么??

Have you compare the result with other semantic segmentation methods?

It is interesting to consider the crowd localization as as segmentation task, impressive!

I wonder to know that have you compare your methods with other well known segmentation methods? It seems that common segmentation network can also be trained with the mask.

Also, in Table 3, it seems that the lower fixed value of threshold, the better performance will be got. Have you try thresholds lower than 0.5? As far as I think, if the center is the only thing needed, the lower threshold will have better performance.

By the way, your IBM/PBM module looks also suitable for other segmentation task, have you test it on other dataset such as COCO?

Best regards.

threshold appear to be nan during the training process

Hi tao han:
I am a graduate student in SEU, trying to replace the backbone of IIM (VGG16_FPN or HRNet) to my Transformer crowd counting model. However, even I low the initial lr 2 1e-6 to 1e-7 in SHA. the threshold even appears to be NAN in the 700 epoch. Also, the best MAE is only 126, which is far away from my model combined with other losses (more than MSE) on SHA.
I noticed that in this link #7 (comment) you have mentioned that we also could lower the initial threshold, I wonder to sure whether is the initial weight 0.5 in the Binarized module. But even I change the initial weight to 0.4, the t_max also starts with 0.54. I get confused with the Binarized module. looking forward to your reply, my email is [email protected]/ [email protected]

> class BinarizedModule(nn.Module):
>   def __init__(self, input_channels=720):
>     super(BinarizedModule, self).__init__()
>     self.Threshold_Module = nn.Sequential(
>         nn.Conv2d(input_channels, 256, kernel_size=3, stride=1, padding=1, bias=False),
> adding=0, bias=False),
>         nn.AvgPool2d(15, stride=1, padding=7),
>     )
>     self.sig = compressedSigmoid()
>     #Change the threshold org to 0.4
>     self.weight = nn.Parameter(torch.Tensor(1).fill_(0.4),requires_grad=True)
>     self.bias = nn.Parameter(torch.Tensor(1).fill_(0), requires_grad=True)

segfault with pytorch 1.17 and 2.0.0

I have tried running IIM for awhile. So far no problem. First indication of problem after using pytorch 2.0.0, with CUDA 11.8

load pre_trained parameters for HR_Net
init weights done
  0%|                                                    | 0/48 [00:00<?, ?it/s]
 212img.jpg  image inference time:  3.727436065673828 133
  2%|▉                                           | 1/48 [00:03<02:55,  3.73s/it]Segmentation fault (core dumped)

No other error lines coming out. Any idea why?

Here is my full environment

Package                      Version              Editable project location
---------------------------- -------------------- --------------------------------------------------------------------------
absl-py                      1.4.0
adal                         1.2.7
addict                       2.4.0
aiofiles                     22.1.0
aiohttp                      3.8.4
aiokafka                     0.8.0
aiosignal                    1.3.1
albumentations               1.3.0
alembic                      1.10.4
antlr4-python3-runtime       4.9.3
anyio                        3.6.2
argcomplete                  2.1.2
argon2-cffi                  21.3.0
argon2-cffi-bindings         21.2.0
arrow                        1.2.3
asgiref                      3.6.0
astor                        0.8.1
asttokens                    2.2.1
astunparse                   1.6.3
async-timeout                4.0.2
attrs                        22.2.0
av                           10.0.0
azure-common                 1.1.28
azure-core                   1.26.4
azure-graphrbac              0.61.1
azure-mgmt-authorization     3.0.0
azure-mgmt-containerregistry 10.1.0
azure-mgmt-core              1.4.0
azure-mgmt-keyvault          10.2.1
azure-mgmt-resource          22.0.0
azure-mgmt-storage           21.0.0
azureml-core                 1.50.0
Babel                        2.12.1
backcall                     0.2.0
backports.tempfile           1.0
backports.weakref            1.0.post1
basicsr                      1.3.4.4              /home/user/Desktop/CC_enhancements/PyDiff_LOL_4Sep23/PyDIff/BasicSR-light
bce-python-sdk               0.8.74
bcrypt                       4.0.1
beautifulsoup4               4.11.1
bleach                       5.0.1
blinker                      1.6.2
boto3                        1.26.126
botocore                     1.29.126
Brotli                       1.0.9
cachetools                   5.2.1
certifi                      2022.12.7
cffi                         1.15.1
cfgv                         3.4.0
charset-normalizer           3.0.1
clearml                      1.10.4
click                        8.1.3
cloudpickle                  2.2.1
cmake                        3.25.0
comm                         0.1.2
contextlib2                  21.6.0
contourpy                    1.0.7
cryptography                 40.0.2
cycler                       0.11.0
Cython                       3.0.2
databricks-cli               0.17.6
dataloader                   2.0
debugpy                      1.6.5
decorator                    5.1.1
defusedxml                   0.7.1
distlib                      0.3.6
Django                       4.1.5
docker                       6.0.1
easydict                     1.10
efficientnet-pytorch         0.7.1
entrypoints                  0.4
et-xmlfile                   1.1.0
executing                    1.2.0
fastapi                      0.89.1
fastjsonschema               2.16.2
filelock                     3.12.0
filterpy                     1.4.5
Flask                        2.3.2
flask-babel                  3.1.0
flatbuffers                  23.5.26
fonttools                    4.38.0
fqdn                         1.5.1
frozenlist                   1.3.3
ftfy                         6.1.1
furl                         2.1.3
future                       0.18.3
gast                         0.4.0
gdown                        4.7.1
gevent                       22.10.2
geventhttpclient             2.0.2
gitdb                        4.0.10
GitPython                    3.1.30
google-api-core              2.11.0
google-auth                  2.16.0
google-auth-oauthlib         1.0.0
google-cloud-core            2.3.2
google-cloud-storage         2.8.0
google-crc32c                1.5.0
google-pasta                 0.2.0
google-resumable-media       2.5.0
googleapis-common-protos     1.59.0
gputils                      1.0.6
greenlet                     2.0.2
grpcio                       1.51.1
gunicorn                     20.1.0
h11                          0.14.0
h5py                         3.9.0
httpcore                     0.17.3
httpx                        0.24.1
huggingface-hub              0.11.1
humanfriendly                10.0
hydra-core                   1.3.1
identify                     2.5.27
idna                         3.4
imageio                      2.24.0
imageio-ffmpeg               0.4.8
imbalanced-learn             0.10.1
imblearn                     0.0
importlib-metadata           6.8.0
imutils                      0.5.4
ipykernel                    6.20.2
ipython                      8.8.0
ipython-genutils             0.2.0
ipywidgets                   8.0.4
isodate                      0.6.1
isoduration                  20.11.0
itsdangerous                 2.1.2
jedi                         0.18.2
jeepney                      0.8.0
Jinja2                       3.1.2
jmespath                     1.0.1
joblib                       1.2.0
jsonpickle                   3.0.1
jsonpointer                  2.3
jsonschema                   4.17.3
jupyter                      1.0.0
jupyter_client               7.4.9
jupyter-console              6.4.4
jupyter_core                 5.1.3
jupyter-events               0.6.3
jupyter_server               2.1.0
jupyter_server_terminals     0.4.4
jupyterlab-pygments          0.2.2
jupyterlab-widgets           3.0.5
kafka-python                 2.0.2
keras                        2.13.1
kiwisolver                   1.4.4
knack                        0.10.1
kornia                       0.7.0
kubernetes                   26.1.0
lap                          0.4.0
lapx                         0.5.4
libclang                     16.0.6
lit                          15.0.7
lmdb                         1.4.1
loguru                       0.7.0
Mako                         1.2.4
Markdown                     3.4.1
MarkupSafe                   2.1.1
matplotlib                   3.6.3
matplotlib-inline            0.1.6
mistune                      2.0.4
mlflow                       2.3.1
mlserver                     1.2.4
mlserver-mlflow              1.3.0
mlxtend                      0.21.0
mpmath                       1.3.0
msal                         1.22.0
msal-extensions              1.0.0
msrest                       0.7.1
msrestazure                  0.6.4
multidict                    6.0.4
munch                        2.5.0
nbclassic                    0.4.8
nbclient                     0.7.2
nbconvert                    7.2.8
nbformat                     5.7.3
ndg-httpsclient              0.5.1
nest-asyncio                 1.5.6
networkx                     3.0
nodeenv                      1.8.0
notebook                     6.5.2
notebook_shim                0.2.2
numpy                        1.23.1
nvidia-cublas-cu11           11.10.3.66
nvidia-cuda-nvrtc-cu11       11.7.99
nvidia-cuda-runtime-cu11     11.7.99
nvidia-cudnn-cu11            8.5.0.96
oauthlib                     3.2.2
omegaconf                    2.3.0
opencv-python                4.5.5.64
openpyxl                     3.1.1
opt-einsum                   3.3.0
orderedmultidict             1.0.1
orjson                       3.8.11
packaging                    23.0
paddle-bfloat                0.1.7
paddlepaddle-gpu             2.5.0
paddleseg                    2.8.0
pandas                       1.5.2
pandocfilters                1.5.0
paramiko                     3.1.0
parso                        0.8.3
pathlib2                     2.3.7.post1
pathspec                     0.11.1
patsy                        0.5.3
pexpect                      4.8.0
pickleshare                  0.7.5
Pillow                       9.4.0
pip                          23.3.1
pkginfo                      1.9.6
platformdirs                 3.10.0
portalocker                  2.7.0
pre-commit                   3.4.0
pretrainedmodels             0.7.4
prettytable                  3.8.0
prometheus-client            0.15.0
prometheus-flask-exporter    0.22.4
prompt-toolkit               3.0.36
protobuf                     4.23.4
psutil                       5.9.4
ptyprocess                   0.7.0
pure-eval                    0.2.2
py-grpc-prometheus           0.7.0
pyarrow                      11.0.0
pyasn1                       0.4.8
pyasn1-modules               0.2.8
pycparser                    2.21
pycryptodome                 3.18.0
pydantic                     1.10.7
Pygments                     2.14.0
PyJWT                        2.4.0
PyNaCl                       1.5.0
pyOpenSSL                    23.1.1
pyparsing                    3.0.9
PyQt5                        5.15.7
PyQt5-Qt5                    5.15.2
PyQt5-sip                    12.11.0
pyrsistent                   0.19.3
pysftp                       0.2.9
PySocks                      1.7.1
python-dateutil              2.8.2
python-dotenv                1.0.0
python-json-logger           2.0.4
python-rapidjson             1.10
pytz                         2022.7.1
PyWavelets                   1.4.1
PyYAML                       6.0
pyzmq                        25.0.0
qtconsole                    5.4.0
QtPy                         2.3.0
qudida                       0.0.4
querystring-parser           1.2.4
rarfile                      4.0
regex                        2023.8.8
requests                     2.28.2
requests-auth-aws-sigv4      0.7
requests-oauthlib            1.3.1
rfc3339-validator            0.1.4
rfc3986-validator            0.1.1
rsa                          4.9
s3transfer                   0.6.0
scikit-image                 0.19.3
scikit-learn                 1.3.0
scipy                        1.10.0
seaborn                      0.12.2
SecretStorage                3.3.3
segmentation-models-pytorch  0.3.2
Send2Trash                   1.8.0
setuptools                   58.1.0
six                          1.16.0
smmap                        5.0.0
sniffio                      1.3.0
soupsieve                    2.3.2.post1
SQLAlchemy                   2.0.12
sqlparse                     0.4.3
stack-data                   0.6.2
starlette                    0.22.0
starlette-exporter           0.15.1
statsmodels                  0.13.5
sympy                        1.12
tabulate                     0.9.0
tb-nightly                   2.15.0a20230902
tensorboard                  2.13.0
tensorboard-data-server      0.7.1
tensorboard-plugin-wit       1.8.1
tensorboardX                 2.6.2
tensorflow                   2.13.0
tensorflow-estimator         2.13.0
tensorflow-io-gcs-filesystem 0.33.0
termcolor                    2.3.0
terminado                    0.17.1
thop                         0.1.1.post2209072238
threadpoolctl                3.1.0
tifffile                     2022.10.10
timm                         0.6.12
tinycss2                     1.2.1
tomli                        2.0.1
torch                        2.0.0+cu118
torchaudio                   2.0.1+cu118
torchmetrics                 0.10.2
torchsummary                 1.5.1
torchvision                  0.15.1+cu118
tornado                      6.2
tqdm                         4.64.1
traitlets                    5.8.1
triton                       2.0.0
tritonclient                 2.33.0
typing_extensions            4.4.0
ultralytics                  8.0.6
uri-template                 1.2.0
urllib3                      1.26.14
uvicorn                      0.22.0
uvloop                       0.17.0
virtualenv                   20.23.0
visualdl                     2.5.3
wcwidth                      0.2.6
webcolors                    1.12
webencodings                 0.5.1
websocket-client             1.4.2
Werkzeug                     2.3.3
wheel                        0.38.4
widgetsnbextension           4.0.5
wrapt                        1.15.0
yacs                         0.1.8
yapf                         0.40.1
yarl                         1.9.2
zipp                         3.11.0
zope.event                   4.6
zope.interface               6.0
apt list --installed cuda*
Listing... Done
cuda-11-8/unknown,now 11.8.0-1 amd64 [installed]
cuda-cccl-11-8/unknown,now 11.8.89-1 amd64 [installed,automatic]
cuda-command-line-tools-11-8/unknown,now 11.8.0-1 amd64 [installed,automatic]
cuda-compiler-11-8/unknown,now 11.8.0-1 amd64 [installed,automatic]
cuda-cudart-11-8/unknown,now 11.8.89-1 amd64 [installed,automatic]
cuda-cudart-dev-11-8/unknown,now 11.8.89-1 amd64 [installed,automatic]
cuda-cuobjdump-11-8/unknown,now 11.8.86-1 amd64 [installed,automatic]
cuda-cupti-11-8/unknown,now 11.8.87-1 amd64 [installed,automatic]
cuda-cupti-dev-11-8/unknown,now 11.8.87-1 amd64 [installed,automatic]
cuda-cuxxfilt-11-8/unknown,now 11.8.86-1 amd64 [installed,automatic]
cuda-demo-suite-11-8/unknown,now 11.8.86-1 amd64 [installed,automatic]
cuda-documentation-11-8/unknown,now 11.8.86-1 amd64 [installed,automatic]
cuda-driver-dev-11-8/unknown,now 11.8.89-1 amd64 [installed,automatic]
cuda-drivers-545/unknown,now 545.23.06-1 amd64 [installed,automatic]
cuda-drivers/unknown,now 545.23.06-1 amd64 [installed,automatic]
cuda-gdb-11-8/unknown,now 11.8.86-1 amd64 [installed,automatic]
cuda-keyring/unknown,now 1.1-1 all [installed]
cuda-libraries-11-8/unknown,now 11.8.0-1 amd64 [installed,automatic]
cuda-libraries-dev-11-8/unknown,now 11.8.0-1 amd64 [installed,automatic]
cuda-memcheck-11-8/unknown,now 11.8.86-1 amd64 [installed,automatic]
cuda-nsight-11-8/unknown,now 11.8.86-1 amd64 [installed,automatic]
cuda-nsight-compute-11-8/unknown,now 11.8.0-1 amd64 [installed,automatic]
cuda-nsight-systems-11-8/unknown,now 11.8.0-1 amd64 [installed,automatic]
cuda-nvcc-11-8/unknown,now 11.8.89-1 amd64 [installed,automatic]
cuda-nvdisasm-11-8/unknown,now 11.8.86-1 amd64 [installed,automatic]
cuda-nvml-dev-11-8/unknown,now 11.8.86-1 amd64 [installed,automatic]
cuda-nvprof-11-8/unknown,now 11.8.87-1 amd64 [installed,automatic]
cuda-nvprune-11-8/unknown,now 11.8.86-1 amd64 [installed,automatic]
cuda-nvrtc-11-8/unknown,now 11.8.89-1 amd64 [installed,automatic]
cuda-nvrtc-dev-11-8/unknown,now 11.8.89-1 amd64 [installed,automatic]
cuda-nvtx-11-8/unknown,now 11.8.86-1 amd64 [installed,automatic]
cuda-nvvp-11-8/unknown,now 11.8.87-1 amd64 [installed,automatic]
cuda-profiler-api-11-8/unknown,now 11.8.86-1 amd64 [installed,automatic]
cuda-repo-ubuntu2004-11-4-local/now 11.4.4-470.82.01-1 amd64 [installed,local]
cuda-runtime-11-8/unknown,now 11.8.0-1 amd64 [installed,automatic]
cuda-sanitizer-11-8/unknown,now 11.8.86-1 amd64 [installed,automatic]
cuda-toolkit-11-8-config-common/unknown,now 11.8.89-1 all [installed,automatic]
cuda-toolkit-11-8/unknown,now 11.8.0-1 amd64 [installed,automatic]
cuda-toolkit-11-config-common/unknown,now 11.8.89-1 all [installed,automatic]
cuda-toolkit-config-common/unknown,now 12.3.52-1 all [installed,automatic]
cuda-tools-11-8/unknown,now 11.8.0-1 amd64 [installed,automatic]
cuda-visual-tools-11-8/unknown,now 11.8.0-1 amd64 [installed,automatic]

could it be the cuda 11.8?

下载

第一个链接进不去

Training on general dataset

Hello authors,

I am trying to put together a custom dataset which has both free view and surveillance view images. May I check the following with you.

  1. What's the general code to refer to for preparing data using scale detect approach as the one with traditional one is giving me continuous blobs for a few images if I try to run a common way of generating the maps for all of my images
  2. Also I understand the training process may take a longer time and resources to train. In my case my custom dataset is around 7K and the resolution varies from small to high. Would you advise which backbone or parameters I can borrow here to use in 2 GPUs with around 8-11 GB memory

Thank you in advance for the timely acknowledgment and response

运行vis4val.py时出错 Key Error 求解~

(IIM) E:\IIM-main\IIM>python vis4val.py
3110
Traceback (most recent call last):
File "vis4val.py", line 101, in
main()
File "vis4val.py", line 34, in main
if gt_data[i_sample]['num'] ==0 and pred_data[i_sample]['num'] !=0:
KeyError: 3110

Cannot load pretrained models

Hi, thank you for sharing your code! This model seems very interesting and promising.
I was trying to test your model on a video, but unfortunately I was not able to load your pre-trained models.
I tried both HR and VGG models, but it always break on load_state_dict()
Do you know why?

netName = 'HR_Net'
GPU_ID = '0'
torch.backends.cudnn.benchmark = True
os.environ["CUDA_VISIBLE_DEVICES"] = GPU_ID
model_path = './saved_model/NWPU-HR-ep_241_F1_0.802_Pre_0.841_Rec_0.766_mae_55.6_mse_330.9.pth'
net = Crowd_locator(netName,GPU_ID,pretrained=True)
net.load_state_dict(torch.load(model_path))
net.eval()

File "/home/walter/anaconda3/envs/crowd/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1052, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for Crowd_locator:
Missing key(s) in state_dict: "Extractor.conv1.weight", "Extractor.bn1.weight", "Extractor.bn1.bias", "Extractor.bn1.running_mean", "Extractor.bn1.running_var", "Extractor.conv2.weight", "Extractor.bn2.weight", "Extractor.bn2.bias", "Extractor.bn2.running_mean", "Extractor.bn2.running_var", "Extractor.layer1.0.conv1.weight", "Extractor.layer1.0.bn1.weight", "Extractor.layer1.0.bn1.bias", "Extractor.layer1.0.bn1.running_mean", "Extractor.layer1.0.bn1.running_var", "Extractor.layer1.0.conv2.weight", "Extractor.layer1.0.bn2.weight", "Extractor.layer1.0.bn2.bias", "Extractor.layer1.0.bn2.running_mean",
[...]

训练时有足够得内存,依然得到out of memory问题

您好,首先感谢您分享了您的稠密目标定位算法,最近我对您得算法进行实现得时候出现了问题,如下:
首先我是在windows10平台上运行得训练过程,前面数据和模型处理好了以后,开始训练出现问题如下:
不论运行那个模型,当模型开始正向执行,总是在第一个conv出爆出问题:
VGG16_FPN.py:
def forward(self, x):
f = []
x = self.layer1(x)
seg_hrnet.py:
def forward(self, x):
residual = x
out = self.conv1(x)
总是爆出内存不足问题,
RuntimeError: CUDA out of memory. Tried to allocate 4.50 GiB (GPU 0; 12.00 GiB total capacity; 886.66 MiB already allocated; 5.14 GiB free; 4.94 GiB reserved in total by PyTorch)
但是其中它想去分配4.5G,(Tried to allocate 4.50 GiB),而我的电脑除了pytorch占用得,还有5G(5.14 GiB free; 4.94 GiB reserved in total by PyTorch).
目前不知道是哪里除了问题,请问您原始代码是在那个平台训练得,ubuntu吗?或者您这边有什么思路可以解决此问题吗?
期待您得回复,万分感谢!

How to config to train on NVIDIA GeForce RTX 3090 Ti/PCIe/SSE2

Hi guys,

I want to train this model on(NVIDIA GeForce RTX 2080 Ti/PCIe/SSE2), RAM 16GB, How to config it.
When I ran the default setting, the bellow error has occored.

    return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
RuntimeError: CUDA error: out of memory
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

主页给的HRNet权重链接hrnetv2_w48_imagenet_pretrained.pth和Crowd_locator中模型结构不太一样

RuntimeError: Error(s) in loading state_dict for Crowd_locator:
Missing key(s) in state_dict: "Extractor.last_layer.0.weight", "Extractor.last_layer.0.bias", "Extractor.last_layer.1.weight", "Extractor.last_layer.1.bias", "Extractor.last_layer.1.running_mean", "Extractor.last_layer.1.running_var", "Extractor.last_layer.3.weight", "Extractor.last_layer.3.bias", "Extractor.last_layer.5.weight", "Extractor.last_layer.5.bias", "Binar.weight", "Binar.bias", "Binar.Threshold_Module.0.weight", "Binar.Threshold_Module.1.weight", "Binar.Threshold_Module.2.weight", "Binar.Threshold_Module.3.weight", "Binar.Threshold_Module.4.weight", "Binar.Threshold_Module.5.weight", "Binar.Threshold_Module.7.weight".
Unexpected key(s) in state_dict: "Extractor.incre_modules.0.0.conv1.weight", "Extractor.incre_modules.0.0.bn1.weight", "Extractor.incre_modules.0.0.bn1.bias", "Extractor.incre_modules.0.0.bn1.running_mean", "Extractor.incre_modules.0.0.bn1.running_var", "Extractor.incre_modules.0.0.bn1.num_batches_tracked", "Extractor.incre_modules.0.0.conv2.weight", "Extractor.incre_modules.0.0.bn2.weight", "Extractor.incre_modules.0.0.bn2.bias", "Extractor.incre_modules.0.0.bn2.running_mean", "Extractor.incre_modules.0.0.bn2.running_var", "Extractor.incre_modules.0.0.bn2.num_batches_tracked", "Extractor.incre_modules.0.0.conv3.weight", "Extractor.incre_modules.0.0.bn3.weight", "Extractor.incre_modules.0.0.bn3.bias", "Extractor.incre_modules.0.0.bn3.running_mean", "Extractor.incre_modules.0.0.bn3.running_var", "Extractor.incre_modules.0.0.bn3.num_batches_tracked", "Extractor.incre_modules.0.0.downsample.0.weight", "Extractor.incre_modules.0.0.downsample.1.weight", "Extractor.incre_modules.0.0.downsample.1.bias", "Extractor.incre_modules.0.0.downsample.1.running_mean", "Extractor.incre_modules.0.0.downsample.1.running_var", "Extractor.incre_modules.0.0.downsample.1.num_batches_tracked", "Extractor.incre_modules.1.0.conv1.weight", "Extractor.incre_modules.1.0.bn1.weight", "Extractor.incre_modules.1.0.bn1.bias", "Extractor.incre_modules.1.0.bn1.running_mean", "Extractor.incre_modules.1.0.bn1.running_var", "Extractor.incre_modules.1.0.bn1.num_batches_tracked", "Extractor.incre_modules.1.0.conv2.weight", "Extractor.incre_modules.1.0.bn2.weight", "Extractor.incre_modules.1.0.bn2.bias", "Extractor.incre_modules.1.0.bn2.running_mean", "Extractor.incre_modules.1.0.bn2.running_var", "Extractor.incre_modules.1.0.bn2.num_batches_tracked", "Extractor.incre_modules.1.0.conv3.weight", "Extractor.incre_modules.1.0.bn3.weight", "Extractor.incre_modules.1.0.bn3.bias", "Extractor.incre_modules.1.0.bn3.running_mean", "Extractor.incre_modules.1.0.bn3.running_var", "Extractor.incre_modules.1.0.bn3.num_batches_tracked", "Extractor.incre_modules.1.0.downsample.0.weight", "Extractor.incre_modules.1.0.downsample.1.weight", "Extractor.incre_modules.1.0.downsample.1.bias", "Extractor.incre_modules.1.0.downsample.1.running_mean", "Extractor.incre_modules.1.0.downsample.1.running_var", "Extractor.incre_modules.1.0.downsample.1.num_batches_tracked", "Extractor.incre_modules.2.0.conv1.weight", "Extractor.incre_modules.2.0.bn1.weight", "Extractor.incre_modules.2.0.bn1.bias", "Extractor.incre_modules.2.0.bn1.running_mean", "Extractor.incre_modules.2.0.bn1.running_var", "Extractor.incre_modules.2.0.bn1.num_batches_tracked", "Extractor.incre_modules.2.0.conv2.weight", "Extractor.incre_modules.2.0.bn2.weight", "Extractor.incre_modules.2.0.bn2.bias", "Extractor.incre_modules.2.0.bn2.running_mean", "Extractor.incre_modules.2.0.bn2.running_var", "Extractor.incre_modules.2.0.bn2.num_batches_tracked", "Extractor.incre_modules.2.0.conv3.weight", "Extractor.incre_modules.2.0.bn3.weight", "Extractor.incre_modules.2.0.bn3.bias", "Extractor.incre_modules.2.0.bn3.running_mean", "Extractor.incre_modules.2.0.bn3.running_var", "Extractor.incre_modules.2.0.bn3.num_batches_tracked", "Extractor.incre_modules.2.0.downsample.0.weight", "Extractor.incre_modules.2.0.downsample.1.weight", "Extractor.incre_modules.2.0.downsample.1.bias", "Extractor.incre_modules.2.0.downsample.1.running_mean", "Extractor.incre_modules.2.0.downsample.1.running_var", "Extractor.incre_modules.2.0.downsample.1.num_batches_tracked", "Extractor.incre_modules.3.0.conv1.weight", "Extractor.incre_modules.3.0.bn1.weight", "Extractor.incre_modules.3.0.bn1.bias", "Extractor.incre_modules.3.0.bn1.running_mean", "Extractor.incre_modules.3.0.bn1.running_var", "Extractor.incre_modules.3.0.bn1.num_batches_tracked", "Extractor.incre_modules.3.0.conv2.weight", "Extractor.incre_modules.3.0.bn2.weight", "Extractor.incre_modules.3.0.bn2.bias", "Extractor.incre_modules.3.0.bn2.running_mean", "Extractor.incre_modules.3.0.bn2.running_var", "Extractor.incre_modules.3.0.bn2.num_batches_tracked", "Extractor.incre_modules.3.0.conv3.weight", "Extractor.incre_modules.3.0.bn3.weight", "Extractor.incre_modules.3.0.bn3.bias", "Extractor.incre_modules.3.0.bn3.running_mean", "Extractor.incre_modules.3.0.bn3.running_var", "Extractor.incre_modules.3.0.bn3.num_batches_tracked", "Extractor.incre_modules.3.0.downsample.0.weight", "Extractor.incre_modules.3.0.downsample.1.weight", "Extractor.incre_modules.3.0.downsample.1.bias", "Extractor.incre_modules.3.0.downsample.1.running_mean", "Extractor.incre_modules.3.0.downsample.1.running_var", "Extractor.incre_modules.3.0.downsample.1.num_batches_tracked", "Extractor.downsamp_modules.0.0.weight", "Extractor.downsamp_modules.0.0.bias", "Extractor.downsamp_modules.0.1.weight", "Extractor.downsamp_modules.0.1.bias", "Extractor.downsamp_modules.0.1.running_mean", "Extractor.downsamp_modules.0.1.running_var", "Extractor.downsamp_modules.0.1.num_batches_tracked", "Extractor.downsamp_modules.1.0.weight", "Extractor.downsamp_modules.1.0.bias", "Extractor.downsamp_modules.1.1.weight", "Extractor.downsamp_modules.1.1.bias", "Extractor.downsamp_modules.1.1.running_mean", "Extractor.downsamp_modules.1.1.running_var", "Extractor.downsamp_modules.1.1.num_batches_tracked", "Extractor.downsamp_modules.2.0.weight", "Extractor.downsamp_modules.2.0.bias", "Extractor.downsamp_modules.2.1.weight", "Extractor.downsamp_modules.2.1.bias", "Extractor.downsamp_modules.2.1.running_mean", "Extractor.downsamp_modules.2.1.running_var", "Extractor.downsamp_modules.2.1.num_batches_tracked", "Extractor.final_layer.0.weight", "Extractor.final_layer.0.bias", "Extractor.final_layer.1.weight", "Extractor.final_layer.1.bias", "Extractor.final_layer.1.running_mean", "Extractor.final_layer.1.running_var", "Extractor.final_layer.1.num_batches_tracked", "Extractor.classifier.weight", "Extractor.classifier.bias".

NAN in training process

image
Hi, when I training the network of NWPU dataset, the results indicates NAN in all following cases. I set the training batch size to 6 for preventing out of memory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.