笔记本SSD目标检测

笔记本SSD目标检测

done
#
# To activate this environment, use
#
#     $ conda activate wind_ssd
#
# To deactivate an active environment, use
#
#     $ conda deactivate


(base) C:\Users\BIM>

 

(wind_ssd) F:\PytorchProject\SSD-master>nvidia-smi
Sat Apr  2 08:22:56 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 466.60       Driver Version: 466.60       CUDA Version: 11.3     |
|-------------------------------+----------------------+----------------------+
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ... WDDM  | 00000000:01:00.0  On |                  N/A |
| N/A   70C    P0   102W /  N/A |  13682MiB / 16384MiB |     34%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A       580      C   ...vs\wind_paddle\python.exe    N/A      |
|    0   N/A  N/A      1440    C+G   Insufficient Permissions        N/A      |
|    0   N/A  N/A      7784    C+G   C:\Windows\explorer.exe         N/A      |
|    0   N/A  N/A      9860    C+G   ...artMenuExperienceHost.exe    N/A      |
|    0   N/A  N/A     10228    C+G   ...5n1h2txyewy\SearchApp.exe    N/A      |
|    0   N/A  N/A     10668    C+G   ...cw5n1h2txyewy\LockApp.exe    N/A      |
|    0   N/A  N/A     11376    C+G   ...bbwe\Microsoft.Photos.exe    N/A      |
|    0   N/A  N/A     11572    C+G   ...2txyewy\TextInputHost.exe    N/A      |
|    0   N/A  N/A     13208    C+G   ...y\ShellExperienceHost.exe    N/A      |
|    0   N/A  N/A    114580    C+G   ...me\Application\chrome.exe    N/A      |
+-----------------------------------------------------------------------------+

(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>

 

conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch

 

(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>pip list
Package            Version
------------------ ---------
brotlipy           0.7.0
certifi            2021.10.8
cffi               1.15.0
charset-normalizer 2.0.4
cryptography       36.0.0
idna               3.3
mkl-fft            1.3.1
mkl-random         1.2.2
mkl-service        2.4.0
numpy              1.21.5
Pillow             9.0.1
pip                21.2.4
pycparser          2.21
pyOpenSSL          22.0.0
PySocks            1.7.1
requests           2.27.1
setuptools         58.0.4
six                1.16.0
torch              1.11.0
torchaudio         0.11.0
torchvision        0.12.0
typing_extensions  4.1.1
urllib3            1.26.8
wheel              0.37.1
win-inet-pton      1.1.0
wincertstore       0.2

(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>

 

git clone https://github.com/lufficc/SSD.git

 

(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>pip install -r requirements.txt
Requirement already satisfied: torch>=1.8 in e:\anaconda3\install\envs\wind_ssd\lib\site-packages (from -r requirements.txt (line 1)) (1.11.0)
Requirement already satisfied: torchvision in e:\anaconda3\install\envs\wind_ssd\lib\site-packages (from -r requirements.txt (line 2)) (0.12.0)
Collecting yacs
  Downloading yacs-0.1.8-py3-none-any.whl (14 kB)
Collecting tqdm
  Using cached tqdm-4.63.1-py2.py3-none-any.whl (76 kB)
Collecting opencv-python
  Using cached opencv_python-4.5.5.64-cp36-abi3-win_amd64.whl (35.4 MB)
Collecting vizer
  Downloading Vizer-0.1.5.tar.gz (2.5 kB)
Requirement already satisfied: typing_extensions in e:\anaconda3\install\envs\wind_ssd\lib\site-packages (from torch>=1.8->-r requirements.txt (line 1)) (4.1.1)
Requirement already satisfied: numpy in e:\anaconda3\install\envs\wind_ssd\lib\site-packages (from torchvision->-r requirements.txt (line 2)) (1.21.5)
Requirement already satisfied: requests in e:\anaconda3\install\envs\wind_ssd\lib\site-packages (from torchvision->-r requirements.txt (line 2)) (2.27.1)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in e:\anaconda3\install\envs\wind_ssd\lib\site-packages (from torchvision->-r requirements.txt (line 2)) (9.0.1)
Collecting PyYAML
  Using cached PyYAML-6.0-cp37-cp37m-win_amd64.whl (153 kB)
Collecting colorama
  Using cached colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Requirement already satisfied: certifi>=2017.4.17 in e:\anaconda3\install\envs\wind_ssd\lib\site-packages (from requests->torchvision->-r requirements.txt (line 2)) (2021.10.8)
Requirement already satisfied: charset-normalizer~=2.0.0 in e:\anaconda3\install\envs\wind_ssd\lib\site-packages (from requests->torchvision->-r requirements.txt (line 2)) (2.0.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in e:\anaconda3\install\envs\wind_ssd\lib\site-packages (from requests->torchvision->-r requirements.txt (line 2)) (1.26.8)
Requirement already satisfied: idna<4,>=2.5 in e:\anaconda3\install\envs\wind_ssd\lib\site-packages (from requests->torchvision->-r requirements.txt (line 2)) (3.3)
Building wheels for collected packages: vizer
  Building wheel for vizer (setup.py) ... done
  Created wheel for vizer: filename=Vizer-0.1.5-py3-none-any.whl size=3507 sha256=a486299c00fe0a123e6ffdb57630b89edf942885c3d3a11f79ee976eb785fea0
  Stored in directory: c:\users\bim\appdata\local\pip\cache\wheels\67\a2\c6\7aaa279c50f12c49cc49233acbfd38e23ae3908c373ea4ec85
Successfully built vizer
Installing collected packages: PyYAML, opencv-python, colorama, yacs, vizer, tqdm
Successfully installed PyYAML-6.0 colorama-0.4.4 opencv-python-4.5.5.64 tqdm-4.63.1 vizer-0.1.5 yacs-0.1.8

(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>

 

python demo.py --config-file configs/vgg_ssd300_voc0712.yaml --images_dir demo --ckpt vgg_ssd300_voc0712.pth

 

 警告:

(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>python demo.py --config-file configs/vgg_ssd300_voc0712.yaml --images_dir demo --ckpt vgg_ssd300_voc0712.pth
F:\PytorchProject\SSD-master\ssd\utils\nms.py:10: UserWarning: No NMS is available. Please upgrade torchvision to 0.3.0+
  warnings.warn('No NMS is available. Please upgrade torchvision to 0.3.0+')

(wind_ssd) F:\PytorchProject\SSD-master>

 

处理:

打开 nms.py,注释掉几行,然后 加上:

_nms = torchvision.ops.nms
print(torchvision.__version__)
print(torchvision.ops.nms)
_nms = torchvision.ops.nms
'''
if torchvision.__version__ >= '0.3.0':
    _nms = torchvision.ops.nms
else:
    warnings.warn('No NMS is available. Please upgrade torchvision to 0.3.0+')
    sys.exit(-1)
'''

 

 再次运行

(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>python demo.py --config-file configs/vgg_ssd300_voc0712.yaml --images_dir demo --ckpt vgg_ssd300_voc0712.pth
0.12.0
<function nms at 0x0000027C42E4B048>
Namespace(ckpt='vgg_ssd300_voc0712.pth', config_file='configs/vgg_ssd300_voc0712.yaml', dataset_type='voc', images_dir='demo', opts=[], output_dir='demo/result', score_threshold=0.7)
Loaded configuration file configs/vgg_ssd300_voc0712.yaml

MODEL:
  NUM_CLASSES: 21
INPUT:
  IMAGE_SIZE: 300
DATASETS:
  TRAIN: ("voc_2007_trainval", "voc_2012_trainval")
  TEST: ("voc_2007_test", )
SOLVER:
  MAX_ITER: 120000
  LR_STEPS: [80000, 100000]
  GAMMA: 0.1
  BATCH_SIZE: 32
  LR: 1e-3

OUTPUT_DIR: 'outputs/vgg_ssd300_voc0712'
Running with config:
DATASETS:
  TEST: ('voc_2007_test',)
  TRAIN: ('voc_2007_trainval', 'voc_2012_trainval')
DATA_LOADER:
  NUM_WORKERS: 8
  PIN_MEMORY: True
INPUT:
  IMAGE_SIZE: 300
  PIXEL_MEAN: [123, 117, 104]
MODEL:
  BACKBONE:
    NAME: vgg
    OUT_CHANNELS: (512, 1024, 512, 256, 256, 256)
    PRETRAINED: True
  BOX_HEAD:
    NAME: SSDBoxHead
    PREDICTOR: SSDBoxPredictor
  CENTER_VARIANCE: 0.1
  DEVICE: cuda
  META_ARCHITECTURE: SSDDetector
  NEG_POS_RATIO: 3
  NUM_CLASSES: 21
  PRIORS:
    ASPECT_RATIOS: [[2], [2, 3], [2, 3], [2, 3], [2], [2]]
    BOXES_PER_LOCATION: [4, 6, 6, 6, 4, 4]
    CLIP: True
    FEATURE_MAPS: [38, 19, 10, 5, 3, 1]
    MAX_SIZES: [60, 111, 162, 213, 264, 315]
    MIN_SIZES: [30, 60, 111, 162, 213, 264]
    STRIDES: [8, 16, 32, 64, 100, 300]
  SIZE_VARIANCE: 0.2
  THRESHOLD: 0.5
OUTPUT_DIR: outputs/vgg_ssd300_voc0712
SOLVER:
  BATCH_SIZE: 32
  GAMMA: 0.1
  LR: 0.001
  LR_STEPS: [80000, 100000]
  MAX_ITER: 120000
  MOMENTUM: 0.9
  WARMUP_FACTOR: 0.3333333333333333
  WARMUP_ITERS: 500
  WEIGHT_DECAY: 0.0005
TEST:
  BATCH_SIZE: 10
  CONFIDENCE_THRESHOLD: 0.01
  MAX_PER_CLASS: -1
  MAX_PER_IMAGE: 100
  NMS_THRESHOLD: 0.45
Loaded weights from vgg_ssd300_voc0712.pth
E:\Anaconda3\install\envs\wind_ssd\lib\site-packages\torch\nn\functional.py:780: UserWarning: Note that order of the arguments: ceil_mode and return_indices will changeto match the args list in nn.MaxPool2d in a future release.
  warnings.warn("Note that order of the arguments: ceil_mode and return_indices will change"
(0001/0015) 2021-06-29_111824.jpg: objects 01 | load 013ms | inference 3301ms | FPS 0
(0002/0015) 20210107164948.jpg: objects 03 | load 026ms | inference 046ms | FPS 22
(0003/0015) 20210107165009.jpg: objects 02 | load 015ms | inference 047ms | FPS 21
(0004/0015) 20210107165329.jpg: objects 03 | load 005ms | inference 050ms | FPS 20
(0005/0015) 20210107165607.jpg: objects 04 | load 008ms | inference 063ms | FPS 16
(0006/0015) 20210107165645.jpg: objects 04 | load 029ms | inference 042ms | FPS 24
(0007/0015) 20210107165946.jpg: objects 04 | load 006ms | inference 026ms | FPS 39
(0008/0015) 20210107170115.jpg: objects 04 | load 006ms | inference 024ms | FPS 42
(0009/0015) 20210107170234.jpg: objects 02 | load 015ms | inference 024ms | FPS 41
(0010/0015) 20210107170250.jpg: objects 04 | load 024ms | inference 035ms | FPS 29
(0011/0015) 20210107170519.jpg: objects 01 | load 017ms | inference 043ms | FPS 23
(0012/0015) 20210107170601.jpg: objects 00 | load 006ms | inference 026ms | FPS 39
(0013/0015) bus.jpg: objects 03 | load 018ms | inference 012ms | FPS 84
(0014/0015) QQ图片20211201092825.jpg: objects 00 | load 240ms | inference 031ms | FPS 32
(0015/0015) zidane.jpg: objects 02 | load 025ms | inference 012ms | FPS 84

(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>
(wind_ssd) F:\PytorchProject\SSD-master>

 

查看检测结果:

 

 

 

###########################

posted @ 2022-04-02 08:42  西北逍遥  阅读(528)  评论(0编辑  收藏  举报