码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Variations-of-SFANet-for-Crowd-Counting记录


    论文:Encoder-Decoder Based Convolutional Neural Networks with Multi-Scale-Aware Modules for Crowd Counting

    论文链接:https://arxiv.org/abs/2003.05586

    源码链接:GitHub - Pongpisit-Thanasutives/Variations-of-SFANet-for-Crowd-Counting: The official implementation of "Encoder-Decoder Based Convolutional Neural Networks with Multi-Scale-Aware Modules for Crowd Counting"

    框架结构:基于点标签的目标检测与计数深度学习框架盘点-CSDN博客

    本文中使用到的框架:

    利用贝叶斯损失(Bayesian loss, BL)的人群计数: GitHub - ZhihengCV/Bayesian-Crowd-Counting: Official Implement of ICCV 2019 oral paper Bayesian Loss for Crowd Count Estimation with Point Supervision

    SFANet: GitHub - pxq0312/SFANet-crowd-counting: This is an unofficial implement of the arXiv paper Dual Path Multi-Scale Fusion Networks with Attention for Crowd Counting by PyTorch.

    上下文信息提取CAN: GitHub - weizheliu/Context-Aware-Crowd-Counting: Official Code for Context-Aware Crowd Counting. CVPR 2019

    要完成UCF-QNRF数据集训练代码,参考:GitHub - ZhihengCV/Bayesian-Crowd-Counting: Official Implement of ICCV 2019 oral paper Bayesian Loss for Crowd Count Estimation with Point Supervision

    要完成Shanghaitech数据集训练代码,参考:GitHub - pxq0312/SFANet-crowd-counting: This is an unofficial implement of the arXiv paper Dual Path Multi-Scale Fusion Networks with Attention for Crowd Counting by PyTorch.

    M-SFANet和M-SegNet实现参考框架中的models部分:https://github.com/Pongpisit-Thanasutives/Variations-of-SFANet-for-Crowd-Counting/tree/master/models

    数据集

    来自工程readme文件,为了再现论文中报告的结果,可以使用这些预处理的数据集。尚未完成,并可能在未来更新。

    使用高斯核处理过的Shanghaitech B 数据集:https://drive.google.com/file/d/1Jjmvp-BEa-_81rXgX1bvdqi5gzteRdJA/view

    贝叶斯处理(处理方式和GitHub - ZhihengCV/Bayesian-Crowd-Counting: Official Implement of ICCV 2019 oral paper Bayesian Loss for Crowd Count Estimation with Point Supervision一样)过的Shanghaitech datasets (A&B):https://drive.google.com/file/d/1azoaoRGxfXI7EkSXGm4RrX18sBnDxUtP/view

    Beijing-BRT dataset(源自GitHub - XMU-smartdsp/Beijing-BRT-dataset):https://drive.google.com/file/d/1JRjdMWtWiLxocHensFfJzqLoJEFksjVy/view

    预训练权重

    Shanghaitech A&B:https://drive.google.com/file/d/1MxGZjapIv6O-hzxEeHY7c93723mhGKrG/view

    测试可视化代码应该使用UCF_QNRF数据集上的预训练M_SegNet*:https://drive.google.com/file/d/1fGuH4o0hKbgdP1kaj9rbjX2HUL1IH0oo/view(M_SFANet*预训练权重也包含在内)

    案例demo

    下面是一个测试案例,使用UCF-QNRF数据集上的预训练M-SFANet*去计数图片中的人。

    测试图片是./images/img_0071.jpg(来自UCF-QNRF测试集)

    1. import cv2
    2. from PIL import Image
    3. import numpy as np
    4. import torch
    5. from torchvision import transforms
    6. from datasets.crowd import Crowd
    7. from models import M_SFANet_UCF_QNRF
    8. # Simple preprocessing.
    9. trans = transforms.Compose([transforms.ToTensor(),
    10. transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
    11. ])
    12. # An example image with the label = 1236.
    13. img = Image.open("./images/img_0071.jpg").convert('RGB')
    14. height, width = img.size[1], img.size[0]
    15. height = round(height / 16) * 16
    16. width = round(width / 16) * 16
    17. img = cv2.resize(np.array(img), (width,height), cv2.INTER_CUBIC)
    18. img = trans(Image.fromarray(img))[None, :]
    19. model = M_SFANet_UCF_QNRF.Model()
    20. # Weights are stored in the Google drive link.
    21. # The model are originally trained on a GPU but, we can also test it on a CPU.
    22. # For ShanghaitechWeights, use torch.load("./ShanghaitechWeights/...")["model"] with M_SFANet.Model() or M_SegNet.Model()
    23. model.load_state_dict(torch.load("./Paper's_weights_UCF_QNRF/best_M-SFANet*_UCF_QNRF.pth",
    24. map_location = torch.device('cpu')))
    25. # Evaluation mode
    26. model.eval()
    27. density_map = model(img)
    28. # Est. count = 1168.37 (67.63 deviates from the ground truth)
    29. print(torch.sum(density_map).item())

    运行上述代码结果如下

  • 相关阅读:
    div 自动跟着滚动条移动
    LVS负载均衡群集NAT模式
    2024全球数字电影摄像机、相机、广播摄像机市场报告
    黑马点评--达人探店
    和对手‘打’成一片
    幼儿园门禁安全教程,新手直接套用
    线性回归算法原理
    go zero手把手教你入门案例
    油猴浏览器(安卓)
    C语言easyx颜色模块+案例
  • 原文地址:https://blog.csdn.net/m0_73832962/article/details/133811355
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号