Closed starsky68 closed 4 years ago
如果没有../results/frame目录,创建一个就可以了,每次运行demo,为了避免不同帧数video相互干扰,都会清空frame目录,然后重新创建
如果没有../results/frame目录,创建一个就可以了,每次运行demo,为了避免不同帧数video相互干扰,都会清空frame目录,然后重新创建
我想用你的预训练模型跑一个视频,我的配置是这样的: self.parser.add_argument('--load_model', default='../models/mcmot_last_track_resdcn_18.pth', help='path to pretrained model') self.parser.add_argument('--input_video', type=str, default='../videos/test.mp4', help='path to the input video') self.parser.add_argument('--output_root', type=str, default='../results', help='expected output root path') self.parser.add_argument('--arch', default='resdcn_18', help='model architecture. Currently tested' 'resdcn_18 |resdcn_34 | resdcn_50 | resfpndcn_34 |' 'dla_34 | hrnet_32 | hrnet_18 | cspdarknet_53') self.parser.add_argument('--input_mode', type=str, default='video', # video or image_dir or img_path_list_txt help='input data type(video or image dir)') self.parser.add_argument('--input_video', type=str, default='../videos/004070202006021341388441.mp4', help='path to the input video') 其他的都是默认的,没有改动,依旧是原来设置,结果一直是这个错误: Fix size testing. training chunk_sizes: [10] The output will be saved to /home/--/MCMOT-MCMOT_Visdrone/src/lib/../../exp/mot/default Net input image size: 1088×608 heads: {'hm': 5, 'wh': 2, 'id': 128, 'reg': 2} 2020-09-11 11:53:57 [INFO]: Starting tracking... 2020-09-11 11:53:57 [INFO]: Starting tracking... Lenth of the video: 3250 frames Creating model... 2020-09-11 11:53:57 [INFO]: unexpected EOF, expected 161141 more bytes. The file might be corrupted. 2020-09-11 11:53:57 [INFO]: unexpected EOF, expected 161141 more bytes. The file might be corrupted. ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-10ubuntu2) configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 [image2 @ 0x55b8787af700] Could find no file with path '../results/frame/%05d.jpg' and index in the range 0-4 ../results/frame/%05d.jpg: No such file or directory
ssh://jaya@192.168.1.211:22/usr/bin/python3 -u /mnt/diskb/even/MCMOT/src/demo.py
Fix size testing.
training chunk_sizes: [10]
The output will be saved to /mnt/diskb/even/MCMOT/src/lib/../../exp/mot/default
Net input image size: 1088×608
heads: {'hm': 5, 'wh': 2, 'id': 128, 'reg': 2}
2020-09-11 14:15:51 [INFO]: Starting tracking...
2020-09-11 14:15:51 [INFO]: Starting tracking...
Lenth of the video: 550 frames
Creating model...
loaded ../exp/mot/default/mcmot_last_track_resdcn_18.pth, epoch 5
2020-09-11 14:15:54 [INFO]: Processing frame 0 (100000.00 fps)
2020-09-11 14:15:54 [INFO]: Processing frame 0 (100000.00 fps)
/pytorch/aten/src/ATen/native/BinaryOps.cpp:81: UserWarning: Integer division of tensors using div or / is deprecated, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead.
2020-09-11 14:15:57 [INFO]: Processing frame 20 (19.12 fps)
2020-09-11 14:15:57 [INFO]: Processing frame 20 (19.12 fps)
2020-09-11 14:15:59 [INFO]: Processing frame 40 (19.37 fps)
2020-09-11 14:15:59 [INFO]: Processing frame 40 (19.37 fps)
2020-09-11 14:16:01 [INFO]: Processing frame 60 (19.74 fps)
2020-09-11 14:16:01 [INFO]: Processing frame 60 (19.74 fps)
2020-09-11 14:16:04 [INFO]: Processing frame 80 (19.95 fps)
2020-09-11 14:16:04 [INFO]: Processing frame 80 (19.95 fps)
2020-09-11 14:16:06 [INFO]: Processing frame 100 (20.22 fps)
2020-09-11 14:16:06 [INFO]: Processing frame 100 (20.22 fps)
2020-09-11 14:16:08 [INFO]: Processing frame 120 (20.42 fps)
2020-09-11 14:16:08 [INFO]: Processing frame 120 (20.42 fps)
2020-09-11 14:16:10 [INFO]: Processing frame 140 (20.48 fps)
2020-09-11 14:16:10 [INFO]: Processing frame 140 (20.48 fps)
2020-09-11 14:16:13 [INFO]: Processing frame 160 (20.48 fps)
2020-09-11 14:16:13 [INFO]: Processing frame 160 (20.48 fps)
2020-09-11 14:16:16 [INFO]: Processing frame 180 (20.44 fps)
2020-09-11 14:16:16 [INFO]: Processing frame 180 (20.44 fps)
2020-09-11 14:16:18 [INFO]: Processing frame 200 (20.51 fps)
2020-09-11 14:16:18 [INFO]: Processing frame 200 (20.51 fps)
2020-09-11 14:16:20 [INFO]: Processing frame 220 (20.59 fps)
2020-09-11 14:16:20 [INFO]: Processing frame 220 (20.59 fps)
2020-09-11 14:16:23 [INFO]: Processing frame 240 (20.62 fps)
2020-09-11 14:16:23 [INFO]: Processing frame 240 (20.62 fps)
2020-09-11 14:16:25 [INFO]: Processing frame 260 (20.62 fps)
2020-09-11 14:16:25 [INFO]: Processing frame 260 (20.62 fps)
2020-09-11 14:16:27 [INFO]: Processing frame 280 (20.65 fps)
2020-09-11 14:16:27 [INFO]: Processing frame 280 (20.65 fps)
2020-09-11 14:16:30 [INFO]: Processing frame 300 (20.72 fps)
2020-09-11 14:16:30 [INFO]: Processing frame 300 (20.72 fps)
2020-09-11 14:16:32 [INFO]: Processing frame 320 (20.79 fps)
2020-09-11 14:16:32 [INFO]: Processing frame 320 (20.79 fps)
2020-09-11 14:16:34 [INFO]: Processing frame 340 (20.85 fps)
2020-09-11 14:16:34 [INFO]: Processing frame 340 (20.85 fps)
2020-09-11 14:16:36 [INFO]: Processing frame 360 (20.91 fps)
2020-09-11 14:16:36 [INFO]: Processing frame 360 (20.91 fps)
2020-09-11 14:16:39 [INFO]: Processing frame 380 (20.94 fps)
2020-09-11 14:16:39 [INFO]: Processing frame 380 (20.94 fps)
2020-09-11 14:16:41 [INFO]: Processing frame 400 (20.93 fps)
2020-09-11 14:16:41 [INFO]: Processing frame 400 (20.93 fps)
2020-09-11 14:16:43 [INFO]: Processing frame 420 (20.94 fps)
2020-09-11 14:16:43 [INFO]: Processing frame 420 (20.94 fps)
2020-09-11 14:16:46 [INFO]: Processing frame 440 (20.95 fps)
2020-09-11 14:16:46 [INFO]: Processing frame 440 (20.95 fps)
2020-09-11 14:16:48 [INFO]: Processing frame 460 (20.98 fps)
2020-09-11 14:16:48 [INFO]: Processing frame 460 (20.98 fps)
2020-09-11 14:16:50 [INFO]: Processing frame 480 (20.98 fps)
2020-09-11 14:16:50 [INFO]: Processing frame 480 (20.98 fps)
2020-09-11 14:16:52 [INFO]: Processing frame 500 (20.99 fps)
2020-09-11 14:16:52 [INFO]: Processing frame 500 (20.99 fps)
2020-09-11 14:16:55 [INFO]: Processing frame 520 (21.00 fps)
2020-09-11 14:16:55 [INFO]: Processing frame 520 (21.00 fps)
2020-09-11 14:16:57 [INFO]: Processing frame 540 (21.03 fps)
2020-09-11 14:16:57 [INFO]: Processing frame 540 (21.03 fps)
2020-09-11 14:16:58 [INFO]: Failed to load frame 547
2020-09-11 14:16:58 [INFO]: Failed to load frame 547
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, image2, from '../results/frame/%05d.jpg':
Duration: 00:00:21.84, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
Please use -b:a or -b:v, -b is ambiguous
File '../results/test5_track.mp4' already exists. Overwrite ? [y/N] y
y
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
[swscaler @ 0x557f3e66f000] deprecated pixel format used, make sure you did set range correctly
Output #0, mp4, to '../results/test5_track.mp4':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc57.107.100 mpeg4
Side data:
cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 0 vbv_delay: -1
frame= 546 fps= 37 q=31.0 Lsize= 13031kB time=00:00:21.80 bitrate=4896.8kbits/s speed=1.49x
video:13028kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.025592%
Process finished with exit code 0
以上是我用resdcn_18跑的输出logging。
from future import absolute_import from future import division from future import print_function
import argparse import os
class opts(object): def init(self): self.parser = argparse.ArgumentParser()
# basic experiment setting
self.parser.add_argument('--task', default='mot', help='mot')
self.parser.add_argument('--dataset', default='jde', help='jde')
self.parser.add_argument('--exp_id', default='default')
self.parser.add_argument('--test', action='store_true')
self.parser.add_argument('--load_model',
default='../exp/mot/default/mcmot_last_track_resdcn_18.pth',
help='path to pretrained model')
self.parser.add_argument('--resume',
action='store_true',
help='resume an experiment. '
'Reloaded the optimizer parameter and '
'set load_model to model_last.pth '
'in the exp dir if load_model is empty.')
# system
self.parser.add_argument('--gpus',
default='6', # 0, 5, 6
help='-1 for CPU, use comma for multiple gpus')
self.parser.add_argument('--num_workers',
type=int,
default=4, # 8, 6, 4
help='dataloader threads. 0 for single-thread.')
self.parser.add_argument('--not_cuda_benchmark', action='store_true',
help='disable when the input size is not fixed.')
self.parser.add_argument('--seed', type=int, default=317,
help='random seed') # from CornerNet
self.parser.add_argument('--gen-scale',
type=bool,
default=True,
help='Whether to generate multi-scales')
self.parser.add_argument('--is_debug',
type=bool,
default=False, # 是否使用多线程加载数据, default: False
help='whether in debug mode or not') # debug模式下只能使用单进程
# log
self.parser.add_argument('--print_iter', type=int, default=0,
help='disable progress bar and print to screen.')
self.parser.add_argument('--hide_data_time', action='store_true',
help='not display time during training.')
self.parser.add_argument('--save_all', action='store_true',
help='save model to disk every 5 epochs.')
self.parser.add_argument('--metric', default='loss',
help='main metric to save best model')
self.parser.add_argument('--vis_thresh', type=float, default=0.5,
help='visualization threshold.')
# model: backbone and so on...
self.parser.add_argument('--arch',
default='resdcn_18',
help='model architecture. Currently tested'
'resdcn_18 |resdcn_34 | resdcn_50 | resfpndcn_34 |'
'dla_34 | hrnet_32 | hrnet_18 | cspdarknet_53')
self.parser.add_argument('--head_conv',
type=int,
default=-1,
help='conv layer channels for output head'
'0 for no conv layer'
'-1 for default setting: '
'256 for resnets and 256 for dla.')
self.parser.add_argument('--down_ratio',
type=int,
default=4, # 输出特征图的下采样率 H=H_image/4 and W=W_image/4
help='output stride. Currently only supports 4.')
# input
self.parser.add_argument('--input_res',
type=int,
default=-1,
help='input height and width. -1 for default from '
'dataset. Will be overriden by input_h | input_w')
self.parser.add_argument('--input_h',
type=int,
default=-1,
help='input height. -1 for default from dataset.')
self.parser.add_argument('--input_w',
type=int,
default=-1,
help='input width. -1 for default from dataset.')
# train
self.parser.add_argument('--lr',
type=float,
default=7e-5, # 1e-4, 7e-5, 5e-5, 3e-5
help='learning rate for batch size 32.')
self.parser.add_argument('--lr_step',
type=str,
default='10,20', # 20,27
help='drop learning rate by 10.')
self.parser.add_argument('--num_epochs',
type=int,
default=30, # 30, 10, 3, 1
help='total training epochs.')
self.parser.add_argument('--batch-size',
type=int,
default=10, # 18, 16, 14, 12, 10, 8, 4
help='batch size')
self.parser.add_argument('--master_batch_size', type=int, default=-1,
help='batch size on the master gpu.')
self.parser.add_argument('--num_iters', type=int, default=-1,
help='default: #samples / batch_size.')
self.parser.add_argument('--val_intervals', type=int, default=10,
help='number of epochs to run validation.')
self.parser.add_argument('--trainval',
action='store_true',
help='include validation in training and '
'test on test set')
# test
self.parser.add_argument('--K',
type=int,
default=200, # 128
help='max number of output objects.') # 一张图输出检测目标最大数量
self.parser.add_argument('--not_prefetch_test',
action='store_true',
help='not use parallal data pre-processing.')
self.parser.add_argument('--fix_res',
action='store_true',
help='fix testing resolution or keep '
'the original resolution')
self.parser.add_argument('--keep_res',
action='store_true',
help='keep the original resolution'
' during validation.')
# tracking
self.parser.add_argument(
'--test_mot16', default=False, help='test mot16')
self.parser.add_argument(
'--val_mot15', default=False, help='val mot15')
self.parser.add_argument(
'--test_mot15', default=False, help='test mot15')
self.parser.add_argument(
'--val_mot16', default=False, help='val mot16 or mot15')
self.parser.add_argument(
'--test_mot17', default=False, help='test mot17')
self.parser.add_argument(
'--val_mot17', default=False, help='val mot17')
self.parser.add_argument(
'--val_mot20', default=False, help='val mot20')
self.parser.add_argument(
'--test_mot20', default=False, help='test mot20')
self.parser.add_argument(
'--conf_thres',
type=float,
default=0.4, # 0.6, 0.4
help='confidence thresh for tracking') # heat-map置信度阈值
self.parser.add_argument('--det_thres',
type=float,
default=0.3,
help='confidence thresh for detection')
self.parser.add_argument('--nms_thres',
type=float,
default=0.4,
help='iou thresh for nms')
self.parser.add_argument('--track_buffer',
type=int,
default=30, # 30
help='tracking buffer')
self.parser.add_argument('--min-box-area',
type=float,
default=200,
help='filter out tiny boxes')
# 测试阶段的输入数据模式: video or image dir
self.parser.add_argument('--input-mode',
type=str,
default='video', # video or image_dir or img_path_list_txt
help='input data type(video or image dir)')
# 输入的video文件路径
self.parser.add_argument('--input-video',
type=str,
default='../videos/test5.mp4',
help='path to the input video')
# 输入的image目录
self.parser.add_argument('--input-img',
type=str,
default='/users/duanyou/c5/all_pretrain/test.txt', # ../images/
help='path to the input image directory or image file list(.txt)')
self.parser.add_argument('--output-format',
type=str,
default='video',
help='video or text')
self.parser.add_argument('--output-root',
type=str,
default='../results',
help='expected output root path')
# mot: 选择数据集的配置文件
self.parser.add_argument('--data_cfg', type=str,
default='../src/lib/cfg/mcmot_det.json', # 'mot15.json', 'visdrone.json'
help='load data from cfg')
# self.parser.add_argument('--data_cfg', type=str,
# default='../src/lib/cfg/mcmot_det.json', # mcmot.json, mcmot_det.json,
# help='load data from cfg')
self.parser.add_argument('--data_dir',
type=str,
default='/mnt/diskb/even/dataset')
# loss
self.parser.add_argument('--mse_loss', # default: false
action='store_true',
help='use mse loss or focal loss to train '
'keypoint heatmaps.')
self.parser.add_argument('--reg_loss',
default='l1',
help='regression loss: sl1 | l1 | l2') # sl1: smooth L1 loss
self.parser.add_argument('--hm_weight',
type=float,
default=1,
help='loss weight for keypoint heatmaps.')
self.parser.add_argument('--off_weight',
type=float,
default=1,
help='loss weight for keypoint local offsets.')
self.parser.add_argument('--wh_weight',
type=float,
default=0.1,
help='loss weight for bounding box size.')
self.parser.add_argument('--id_loss',
default='ce',
help='reid loss: ce | triplet')
self.parser.add_argument('--id_weight',
type=float,
default=1, # 0for detection only and 1 for detection and re-ida
help='loss weight for id') # ReID feature extraction or not
self.parser.add_argument('--reid_dim',
type=int,
default=128, # 128, 256, 512
help='feature dim for reid')
self.parser.add_argument('--input-wh',
type=tuple,
default=(1088, 608), # (768, 448) or (1088, 608)
help='net input resplution')
self.parser.add_argument('--multi-scale',
type=bool,
default=True,
help='Whether to use multi-scale training or not')
# ----------------------1~10 object classes are what we need
# pedestrian (1), --> 0
# people (2), --> 1
# bicycle (3), --> 2
# car (4), --> 3
# van (5), --> 4
# truck (6), --> 5
# tricycle (7), --> 6
# awning-tricycle (8), --> 7
# bus (9), --> 8
# motor (10), --> 9
# ----------------------
# others (11)
self.parser.add_argument('--reid_cls_ids',
default='0,1,2,3,4', # '0,1,2,3,4' or '0,1,2,3,4,5,6,7,8,9'
help='') # the object classes need to do reid
self.parser.add_argument('--norm_wh', action='store_true',
help='L1(\hat(y) / y, 1) or L1(\hat(y), y)')
self.parser.add_argument('--dense_wh', action='store_true',
help='apply weighted regression near center or '
'just apply regression on center point.')
self.parser.add_argument('--cat_spec_wh',
action='store_true',
help='category specific bounding box size.')
self.parser.add_argument('--not_reg_offset',
action='store_true',
help='not regress local offset.')
def parse(self, args=''):
if args == '':
opt = self.parser.parse_args()
else:
opt = self.parser.parse_args(args)
opt.gpus_str = opt.gpus
opt.gpus = [int(gpu) for gpu in opt.gpus.split(',')]
# opt.gpus = [i for i in range(len(opt.gpus))] if opt.gpus[0] >= 0 else [-1]
# print("opt.gpus", opt.gpus)
opt.lr_step = [int(i) for i in opt.lr_step.split(',')]
opt.fix_res = not opt.keep_res
print('Fix size testing.' if opt.fix_res else 'Keep resolution testing.')
opt.reg_offset = not opt.not_reg_offset
if opt.head_conv == -1: # init default head_conv
opt.head_conv = 256 if 'dla' in opt.arch else 256
opt.pad = 31
opt.num_stacks = 1
if opt.trainval:
opt.val_intervals = 100000000
if opt.master_batch_size == -1:
opt.master_batch_size = opt.batch_size // len(opt.gpus)
rest_batch_size = (opt.batch_size - opt.master_batch_size)
opt.chunk_sizes = [opt.master_batch_size]
for i in range(len(opt.gpus) - 1):
slave_chunk_size = rest_batch_size // (len(opt.gpus) - 1)
if i < rest_batch_size % (len(opt.gpus) - 1):
slave_chunk_size += 1
opt.chunk_sizes.append(slave_chunk_size)
print('training chunk_sizes:', opt.chunk_sizes)
opt.root_dir = os.path.join(os.path.dirname(__file__), '..', '..')
opt.exp_dir = os.path.join(opt.root_dir, 'exp', opt.task)
opt.save_dir = os.path.join(opt.exp_dir, opt.exp_id)
opt.debug_dir = os.path.join(opt.save_dir, 'debug')
print('The output will be saved to ', opt.save_dir)
if opt.resume and opt.load_model == '':
model_path = opt.save_dir[:-4] if opt.save_dir.endswith('TEST') \
else opt.save_dir
opt.load_model = os.path.join(model_path, 'model_last.pth')
return opt
def update_dataset_info_and_set_heads(self, opt, dataset):
"""
:param opt:
:param dataset:
:return:
"""
input_h, input_w = dataset.default_input_wh # 图片的高和宽
opt.mean, opt.std = dataset.mean, dataset.std # 均值 方差
opt.num_classes = dataset.num_classes # 类别数
for reid_id in opt.reid_cls_ids.split(','):
if int(reid_id) > opt.num_classes - 1:
print('[Err]: configuration conflict of reid_cls_ids and num_classes!')
return
# input_h(w): opt.input_h overrides opt.input_res overrides dataset default
input_h = opt.input_res if opt.input_res > 0 else input_h
input_w = opt.input_res if opt.input_res > 0 else input_w
opt.input_h = opt.input_h if opt.input_h > 0 else input_h
opt.input_w = opt.input_w if opt.input_w > 0 else input_w
opt.output_h = opt.input_h // opt.down_ratio # 输出特征图的宽高
opt.output_w = opt.input_w // opt.down_ratio
opt.input_res = max(opt.input_h, opt.input_w)
opt.output_res = max(opt.output_h, opt.output_w)
if opt.task == 'mot':
opt.heads = {'hm': opt.num_classes,
'wh': 2 if not opt.cat_spec_wh else 2 * opt.num_classes,
'id': opt.reid_dim}
if opt.reg_offset:
opt.heads.update({'reg': 2})
# opt.nID = dataset.nID
# @even: 用nID_dict取代nID
if opt.id_weight > 0:
opt.nID_dict = dataset.nID_dict
# opt.img_size = (640, 320) # (1088, 608)
else:
assert 0, 'task not defined!'
print('heads: ', opt.heads)
return opt
def init(self, args=''):
opt = self.parse(args)
default_dataset_info = {
'mot': {'default_input_wh': [opt.input_wh[1], opt.input_wh[0]], # [608, 1088], [320, 640]
'num_classes': len(opt.reid_cls_ids.split(',')), # 1
'mean': [0.408, 0.447, 0.470],
'std': [0.289, 0.274, 0.278],
'dataset': 'jde',
'nID': 14455,
'nID_dict': {}},
}
class Struct:
def __init__(self, entries):
for k, v in entries.items():
self.__setattr__(k, v)
h_w = default_dataset_info[opt.task]['default_input_wh']
opt.img_size = (h_w[1], h_w[0])
print('Net input image size: {:d}×{:d}'.format(h_w[1], h_w[0]))
dataset = Struct(default_dataset_info[opt.task])
opt.dataset = dataset.dataset
opt = self.update_dataset_info_and_set_heads(opt, dataset)
return opt
这部分是我详细的opt配置文件,刚上传了新代码,你重新下载下来跑一次,我看看logging文件,根据你之前的logging “2020-09-11 11:53:57 [INFO]: unexpected EOF, expected 161141 more bytes. The file might be corrupted. 2020-09-11 11:53:57 [INFO]: unexpected EOF, expected 161141 more bytes. The file might be corrupted.”可能是其他问题。
ssh://jaya@192.168.1.211:22/usr/bin/python3 -u /mnt/diskb/even/MCMOT/src/demo.py Fix size testing. training chunk_sizes: [10] The output will be saved to /mnt/diskb/even/MCMOT/src/lib/../../exp/mot/default Net input image size: 1088×608 heads: {'hm': 5, 'wh': 2, 'id': 128, 'reg': 2} 2020-09-11 14:15:51 [INFO]: Starting tracking... 2020-09-11 14:15:51 [INFO]: Starting tracking... Lenth of the video: 550 frames Creating model... loaded ../exp/mot/default/mcmot_last_track_resdcn_18.pth, epoch 5 2020-09-11 14:15:54 [INFO]: Processing frame 0 (100000.00 fps) 2020-09-11 14:15:54 [INFO]: Processing frame 0 (100000.00 fps) /pytorch/aten/src/ATen/native/BinaryOps.cpp:81: UserWarning: Integer division of tensors using div or / is deprecated, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead. 2020-09-11 14:15:57 [INFO]: Processing frame 20 (19.12 fps) 2020-09-11 14:15:57 [INFO]: Processing frame 20 (19.12 fps) 2020-09-11 14:15:59 [INFO]: Processing frame 40 (19.37 fps) 2020-09-11 14:15:59 [INFO]: Processing frame 40 (19.37 fps) 2020-09-11 14:16:01 [INFO]: Processing frame 60 (19.74 fps) 2020-09-11 14:16:01 [INFO]: Processing frame 60 (19.74 fps) 2020-09-11 14:16:04 [INFO]: Processing frame 80 (19.95 fps) 2020-09-11 14:16:04 [INFO]: Processing frame 80 (19.95 fps) 2020-09-11 14:16:06 [INFO]: Processing frame 100 (20.22 fps) 2020-09-11 14:16:06 [INFO]: Processing frame 100 (20.22 fps) 2020-09-11 14:16:08 [INFO]: Processing frame 120 (20.42 fps) 2020-09-11 14:16:08 [INFO]: Processing frame 120 (20.42 fps) 2020-09-11 14:16:10 [INFO]: Processing frame 140 (20.48 fps) 2020-09-11 14:16:10 [INFO]: Processing frame 140 (20.48 fps) 2020-09-11 14:16:13 [INFO]: Processing frame 160 (20.48 fps) 2020-09-11 14:16:13 [INFO]: Processing frame 160 (20.48 fps) 2020-09-11 14:16:16 [INFO]: Processing frame 180 (20.44 fps) 2020-09-11 14:16:16 [INFO]: Processing frame 180 (20.44 fps) 2020-09-11 14:16:18 [INFO]: Processing frame 200 (20.51 fps) 2020-09-11 14:16:18 [INFO]: Processing frame 200 (20.51 fps) 2020-09-11 14:16:20 [INFO]: Processing frame 220 (20.59 fps) 2020-09-11 14:16:20 [INFO]: Processing frame 220 (20.59 fps) 2020-09-11 14:16:23 [INFO]: Processing frame 240 (20.62 fps) 2020-09-11 14:16:23 [INFO]: Processing frame 240 (20.62 fps) 2020-09-11 14:16:25 [INFO]: Processing frame 260 (20.62 fps) 2020-09-11 14:16:25 [INFO]: Processing frame 260 (20.62 fps) 2020-09-11 14:16:27 [INFO]: Processing frame 280 (20.65 fps) 2020-09-11 14:16:27 [INFO]: Processing frame 280 (20.65 fps) 2020-09-11 14:16:30 [INFO]: Processing frame 300 (20.72 fps) 2020-09-11 14:16:30 [INFO]: Processing frame 300 (20.72 fps) 2020-09-11 14:16:32 [INFO]: Processing frame 320 (20.79 fps) 2020-09-11 14:16:32 [INFO]: Processing frame 320 (20.79 fps) 2020-09-11 14:16:34 [INFO]: Processing frame 340 (20.85 fps) 2020-09-11 14:16:34 [INFO]: Processing frame 340 (20.85 fps) 2020-09-11 14:16:36 [INFO]: Processing frame 360 (20.91 fps) 2020-09-11 14:16:36 [INFO]: Processing frame 360 (20.91 fps) 2020-09-11 14:16:39 [INFO]: Processing frame 380 (20.94 fps) 2020-09-11 14:16:39 [INFO]: Processing frame 380 (20.94 fps) 2020-09-11 14:16:41 [INFO]: Processing frame 400 (20.93 fps) 2020-09-11 14:16:41 [INFO]: Processing frame 400 (20.93 fps) 2020-09-11 14:16:43 [INFO]: Processing frame 420 (20.94 fps) 2020-09-11 14:16:43 [INFO]: Processing frame 420 (20.94 fps) 2020-09-11 14:16:46 [INFO]: Processing frame 440 (20.95 fps) 2020-09-11 14:16:46 [INFO]: Processing frame 440 (20.95 fps) 2020-09-11 14:16:48 [INFO]: Processing frame 460 (20.98 fps) 2020-09-11 14:16:48 [INFO]: Processing frame 460 (20.98 fps) 2020-09-11 14:16:50 [INFO]: Processing frame 480 (20.98 fps) 2020-09-11 14:16:50 [INFO]: Processing frame 480 (20.98 fps) 2020-09-11 14:16:52 [INFO]: Processing frame 500 (20.99 fps) 2020-09-11 14:16:52 [INFO]: Processing frame 500 (20.99 fps) 2020-09-11 14:16:55 [INFO]: Processing frame 520 (21.00 fps) 2020-09-11 14:16:55 [INFO]: Processing frame 520 (21.00 fps) 2020-09-11 14:16:57 [INFO]: Processing frame 540 (21.03 fps) 2020-09-11 14:16:57 [INFO]: Processing frame 540 (21.03 fps) 2020-09-11 14:16:58 [INFO]: Failed to load frame 547 2020-09-11 14:16:58 [INFO]: Failed to load frame 547 ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 7 (Ubuntu 7.3.0-16ubuntu3) configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Input #0, image2, from '../results/frame/%05d.jpg': Duration: 00:00:21.84, start: 0.000000, bitrate: N/A Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc Please use -b:a or -b:v, -b is ambiguous File '../results/test5_track.mp4' already exists. Overwrite ? [y/N] y y Stream mapping: Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg4 (native)) Press [q] to stop, [?] for help [swscaler @ 0x557f3e66f000] deprecated pixel format used, make sure you did set range correctly Output #0, mp4, to '../results/test5_track.mp4': Metadata: encoder : Lavf57.83.100 Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 25 fps, 12800 tbn, 25 tbc Metadata: encoder : Lavc57.107.100 mpeg4 Side data: cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 0 vbv_delay: -1 frame= 546 fps= 37 q=31.0 Lsize= 13031kB time=00:00:21.80 bitrate=4896.8kbits/s speed=1.49x video:13028kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.025592%
Process finished with exit code 0
以上是我用resdcn_18跑的输出logging。
from future import absolute_import from future import division from future import print_function
import argparse import os
class opts(object): def init(self): self.parser = argparse.ArgumentParser()
# basic experiment setting self.parser.add_argument('--task', default='mot', help='mot') self.parser.add_argument('--dataset', default='jde', help='jde') self.parser.add_argument('--exp_id', default='default') self.parser.add_argument('--test', action='store_true') self.parser.add_argument('--load_model', default='../exp/mot/default/mcmot_last_track_resdcn_18.pth', help='path to pretrained model') self.parser.add_argument('--resume', action='store_true', help='resume an experiment. ' 'Reloaded the optimizer parameter and ' 'set load_model to model_last.pth ' 'in the exp dir if load_model is empty.') # system self.parser.add_argument('--gpus', default='6', # 0, 5, 6 help='-1 for CPU, use comma for multiple gpus') self.parser.add_argument('--num_workers', type=int, default=4, # 8, 6, 4 help='dataloader threads. 0 for single-thread.') self.parser.add_argument('--not_cuda_benchmark', action='store_true', help='disable when the input size is not fixed.') self.parser.add_argument('--seed', type=int, default=317, help='random seed') # from CornerNet self.parser.add_argument('--gen-scale', type=bool, default=True, help='Whether to generate multi-scales') self.parser.add_argument('--is_debug', type=bool, default=False, # 是否使用多线程加载数据, default: False help='whether in debug mode or not') # debug模式下只能使用单进程 # log self.parser.add_argument('--print_iter', type=int, default=0, help='disable progress bar and print to screen.') self.parser.add_argument('--hide_data_time', action='store_true', help='not display time during training.') self.parser.add_argument('--save_all', action='store_true', help='save model to disk every 5 epochs.') self.parser.add_argument('--metric', default='loss', help='main metric to save best model') self.parser.add_argument('--vis_thresh', type=float, default=0.5, help='visualization threshold.') # model: backbone and so on... self.parser.add_argument('--arch', default='resdcn_18', help='model architecture. Currently tested' 'resdcn_18 |resdcn_34 | resdcn_50 | resfpndcn_34 |' 'dla_34 | hrnet_32 | hrnet_18 | cspdarknet_53') self.parser.add_argument('--head_conv', type=int, default=-1, help='conv layer channels for output head' '0 for no conv layer' '-1 for default setting: ' '256 for resnets and 256 for dla.') self.parser.add_argument('--down_ratio', type=int, default=4, # 输出特征图的下采样率 H=H_image/4 and W=W_image/4 help='output stride. Currently only supports 4.') # input self.parser.add_argument('--input_res', type=int, default=-1, help='input height and width. -1 for default from ' 'dataset. Will be overriden by input_h | input_w') self.parser.add_argument('--input_h', type=int, default=-1, help='input height. -1 for default from dataset.') self.parser.add_argument('--input_w', type=int, default=-1, help='input width. -1 for default from dataset.') # train self.parser.add_argument('--lr', type=float, default=7e-5, # 1e-4, 7e-5, 5e-5, 3e-5 help='learning rate for batch size 32.') self.parser.add_argument('--lr_step', type=str, default='10,20', # 20,27 help='drop learning rate by 10.') self.parser.add_argument('--num_epochs', type=int, default=30, # 30, 10, 3, 1 help='total training epochs.') self.parser.add_argument('--batch-size', type=int, default=10, # 18, 16, 14, 12, 10, 8, 4 help='batch size') self.parser.add_argument('--master_batch_size', type=int, default=-1, help='batch size on the master gpu.') self.parser.add_argument('--num_iters', type=int, default=-1, help='default: #samples / batch_size.') self.parser.add_argument('--val_intervals', type=int, default=10, help='number of epochs to run validation.') self.parser.add_argument('--trainval', action='store_true', help='include validation in training and ' 'test on test set') # test self.parser.add_argument('--K', type=int, default=200, # 128 help='max number of output objects.') # 一张图输出检测目标最大数量 self.parser.add_argument('--not_prefetch_test', action='store_true', help='not use parallal data pre-processing.') self.parser.add_argument('--fix_res', action='store_true', help='fix testing resolution or keep ' 'the original resolution') self.parser.add_argument('--keep_res', action='store_true', help='keep the original resolution' ' during validation.') # tracking self.parser.add_argument( '--test_mot16', default=False, help='test mot16') self.parser.add_argument( '--val_mot15', default=False, help='val mot15') self.parser.add_argument( '--test_mot15', default=False, help='test mot15') self.parser.add_argument( '--val_mot16', default=False, help='val mot16 or mot15') self.parser.add_argument( '--test_mot17', default=False, help='test mot17') self.parser.add_argument( '--val_mot17', default=False, help='val mot17') self.parser.add_argument( '--val_mot20', default=False, help='val mot20') self.parser.add_argument( '--test_mot20', default=False, help='test mot20') self.parser.add_argument( '--conf_thres', type=float, default=0.4, # 0.6, 0.4 help='confidence thresh for tracking') # heat-map置信度阈值 self.parser.add_argument('--det_thres', type=float, default=0.3, help='confidence thresh for detection') self.parser.add_argument('--nms_thres', type=float, default=0.4, help='iou thresh for nms') self.parser.add_argument('--track_buffer', type=int, default=30, # 30 help='tracking buffer') self.parser.add_argument('--min-box-area', type=float, default=200, help='filter out tiny boxes') # 测试阶段的输入数据模式: video or image dir self.parser.add_argument('--input-mode', type=str, default='video', # video or image_dir or img_path_list_txt help='input data type(video or image dir)') # 输入的video文件路径 self.parser.add_argument('--input-video', type=str, default='../videos/test5.mp4', help='path to the input video') # 输入的image目录 self.parser.add_argument('--input-img', type=str, default='/users/duanyou/c5/all_pretrain/test.txt', # ../images/ help='path to the input image directory or image file list(.txt)') self.parser.add_argument('--output-format', type=str, default='video', help='video or text') self.parser.add_argument('--output-root', type=str, default='../results', help='expected output root path') # mot: 选择数据集的配置文件 self.parser.add_argument('--data_cfg', type=str, default='../src/lib/cfg/mcmot_det.json', # 'mot15.json', 'visdrone.json' help='load data from cfg') # self.parser.add_argument('--data_cfg', type=str, # default='../src/lib/cfg/mcmot_det.json', # mcmot.json, mcmot_det.json, # help='load data from cfg') self.parser.add_argument('--data_dir', type=str, default='/mnt/diskb/even/dataset') # loss self.parser.add_argument('--mse_loss', # default: false action='store_true', help='use mse loss or focal loss to train ' 'keypoint heatmaps.') self.parser.add_argument('--reg_loss', default='l1', help='regression loss: sl1 | l1 | l2') # sl1: smooth L1 loss self.parser.add_argument('--hm_weight', type=float, default=1, help='loss weight for keypoint heatmaps.') self.parser.add_argument('--off_weight', type=float, default=1, help='loss weight for keypoint local offsets.') self.parser.add_argument('--wh_weight', type=float, default=0.1, help='loss weight for bounding box size.') self.parser.add_argument('--id_loss', default='ce', help='reid loss: ce | triplet') self.parser.add_argument('--id_weight', type=float, default=1, # 0for detection only and 1 for detection and re-ida help='loss weight for id') # ReID feature extraction or not self.parser.add_argument('--reid_dim', type=int, default=128, # 128, 256, 512 help='feature dim for reid') self.parser.add_argument('--input-wh', type=tuple, default=(1088, 608), # (768, 448) or (1088, 608) help='net input resplution') self.parser.add_argument('--multi-scale', type=bool, default=True, help='Whether to use multi-scale training or not') # ----------------------1~10 object classes are what we need # pedestrian (1), --> 0 # people (2), --> 1 # bicycle (3), --> 2 # car (4), --> 3 # van (5), --> 4 # truck (6), --> 5 # tricycle (7), --> 6 # awning-tricycle (8), --> 7 # bus (9), --> 8 # motor (10), --> 9 # ---------------------- # others (11) self.parser.add_argument('--reid_cls_ids', default='0,1,2,3,4', # '0,1,2,3,4' or '0,1,2,3,4,5,6,7,8,9' help='') # the object classes need to do reid self.parser.add_argument('--norm_wh', action='store_true', help='L1(\hat(y) / y, 1) or L1(\hat(y), y)') self.parser.add_argument('--dense_wh', action='store_true', help='apply weighted regression near center or ' 'just apply regression on center point.') self.parser.add_argument('--cat_spec_wh', action='store_true', help='category specific bounding box size.') self.parser.add_argument('--not_reg_offset', action='store_true', help='not regress local offset.') def parse(self, args=''): if args == '': opt = self.parser.parse_args() else: opt = self.parser.parse_args(args) opt.gpus_str = opt.gpus opt.gpus = [int(gpu) for gpu in opt.gpus.split(',')] # opt.gpus = [i for i in range(len(opt.gpus))] if opt.gpus[0] >= 0 else [-1] # print("opt.gpus", opt.gpus) opt.lr_step = [int(i) for i in opt.lr_step.split(',')] opt.fix_res = not opt.keep_res print('Fix size testing.' if opt.fix_res else 'Keep resolution testing.') opt.reg_offset = not opt.not_reg_offset if opt.head_conv == -1: # init default head_conv opt.head_conv = 256 if 'dla' in opt.arch else 256 opt.pad = 31 opt.num_stacks = 1 if opt.trainval: opt.val_intervals = 100000000 if opt.master_batch_size == -1: opt.master_batch_size = opt.batch_size // len(opt.gpus) rest_batch_size = (opt.batch_size - opt.master_batch_size) opt.chunk_sizes = [opt.master_batch_size] for i in range(len(opt.gpus) - 1): slave_chunk_size = rest_batch_size // (len(opt.gpus) - 1) if i < rest_batch_size % (len(opt.gpus) - 1): slave_chunk_size += 1 opt.chunk_sizes.append(slave_chunk_size) print('training chunk_sizes:', opt.chunk_sizes) opt.root_dir = os.path.join(os.path.dirname(__file__), '..', '..') opt.exp_dir = os.path.join(opt.root_dir, 'exp', opt.task) opt.save_dir = os.path.join(opt.exp_dir, opt.exp_id) opt.debug_dir = os.path.join(opt.save_dir, 'debug') print('The output will be saved to ', opt.save_dir) if opt.resume and opt.load_model == '': model_path = opt.save_dir[:-4] if opt.save_dir.endswith('TEST') \ else opt.save_dir opt.load_model = os.path.join(model_path, 'model_last.pth') return opt def update_dataset_info_and_set_heads(self, opt, dataset): """ :param opt: :param dataset: :return: """ input_h, input_w = dataset.default_input_wh # 图片的高和宽 opt.mean, opt.std = dataset.mean, dataset.std # 均值 方差 opt.num_classes = dataset.num_classes # 类别数 for reid_id in opt.reid_cls_ids.split(','): if int(reid_id) > opt.num_classes - 1: print('[Err]: configuration conflict of reid_cls_ids and num_classes!') return # input_h(w): opt.input_h overrides opt.input_res overrides dataset default input_h = opt.input_res if opt.input_res > 0 else input_h input_w = opt.input_res if opt.input_res > 0 else input_w opt.input_h = opt.input_h if opt.input_h > 0 else input_h opt.input_w = opt.input_w if opt.input_w > 0 else input_w opt.output_h = opt.input_h // opt.down_ratio # 输出特征图的宽高 opt.output_w = opt.input_w // opt.down_ratio opt.input_res = max(opt.input_h, opt.input_w) opt.output_res = max(opt.output_h, opt.output_w) if opt.task == 'mot': opt.heads = {'hm': opt.num_classes, 'wh': 2 if not opt.cat_spec_wh else 2 * opt.num_classes, 'id': opt.reid_dim} if opt.reg_offset: opt.heads.update({'reg': 2}) # opt.nID = dataset.nID # @even: 用nID_dict取代nID if opt.id_weight > 0: opt.nID_dict = dataset.nID_dict # opt.img_size = (640, 320) # (1088, 608) else: assert 0, 'task not defined!' print('heads: ', opt.heads) return opt def init(self, args=''): opt = self.parse(args) default_dataset_info = { 'mot': {'default_input_wh': [opt.input_wh[1], opt.input_wh[0]], # [608, 1088], [320, 640] 'num_classes': len(opt.reid_cls_ids.split(',')), # 1 'mean': [0.408, 0.447, 0.470], 'std': [0.289, 0.274, 0.278], 'dataset': 'jde', 'nID': 14455, 'nID_dict': {}}, } class Struct: def __init__(self, entries): for k, v in entries.items(): self.__setattr__(k, v) h_w = default_dataset_info[opt.task]['default_input_wh'] opt.img_size = (h_w[1], h_w[0]) print('Net input image size: {:d}×{:d}'.format(h_w[1], h_w[0])) dataset = Struct(default_dataset_info[opt.task]) opt.dataset = dataset.dataset opt = self.update_dataset_info_and_set_heads(opt, dataset) return opt
这部分是我详细的opt配置文件,刚上传了新代码,你重新下载下来跑一次,我看看logging文件,根据你之前的logging “2020-09-11 11:53:57 [INFO]: unexpected EOF, expected 161141 more bytes. The file might be corrupted. 2020-09-11 11:53:57 [INFO]: unexpected EOF, expected 161141 more bytes. The file might be corrupted.”可能是其他问题。
好的,真的非常感谢你的帮助,谢谢了
ssh://jaya@192.168.1.211:22/usr/bin/python3 -u /mnt/diskb/even/MCMOT/src/demo.py Fix size testing. training chunk_sizes: [10] The output will be saved to /mnt/diskb/even/MCMOT/src/lib/../../exp/mot/default Net input image size: 1088×608 heads: {'hm': 5, 'wh': 2, 'id': 128, 'reg': 2} 2020-09-11 14:15:51 [INFO]: Starting tracking... 2020-09-11 14:15:51 [INFO]: Starting tracking... Lenth of the video: 550 frames Creating model... loaded ../exp/mot/default/mcmot_last_track_resdcn_18.pth, epoch 5 2020-09-11 14:15:54 [INFO]: Processing frame 0 (100000.00 fps) 2020-09-11 14:15:54 [INFO]: Processing frame 0 (100000.00 fps) /pytorch/aten/src/ATen/native/BinaryOps.cpp:81: UserWarning: Integer division of tensors using div or / is deprecated, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead. 2020-09-11 14:15:57 [INFO]: Processing frame 20 (19.12 fps) 2020-09-11 14:15:57 [INFO]: Processing frame 20 (19.12 fps) 2020-09-11 14:15:59 [INFO]: Processing frame 40 (19.37 fps) 2020-09-11 14:15:59 [INFO]: Processing frame 40 (19.37 fps) 2020-09-11 14:16:01 [INFO]: Processing frame 60 (19.74 fps) 2020-09-11 14:16:01 [INFO]: Processing frame 60 (19.74 fps) 2020-09-11 14:16:04 [INFO]: Processing frame 80 (19.95 fps) 2020-09-11 14:16:04 [INFO]: Processing frame 80 (19.95 fps) 2020-09-11 14:16:06 [INFO]: Processing frame 100 (20.22 fps) 2020-09-11 14:16:06 [INFO]: Processing frame 100 (20.22 fps) 2020-09-11 14:16:08 [INFO]: Processing frame 120 (20.42 fps) 2020-09-11 14:16:08 [INFO]: Processing frame 120 (20.42 fps) 2020-09-11 14:16:10 [INFO]: Processing frame 140 (20.48 fps) 2020-09-11 14:16:10 [INFO]: Processing frame 140 (20.48 fps) 2020-09-11 14:16:13 [INFO]: Processing frame 160 (20.48 fps) 2020-09-11 14:16:13 [INFO]: Processing frame 160 (20.48 fps) 2020-09-11 14:16:16 [INFO]: Processing frame 180 (20.44 fps) 2020-09-11 14:16:16 [INFO]: Processing frame 180 (20.44 fps) 2020-09-11 14:16:18 [INFO]: Processing frame 200 (20.51 fps) 2020-09-11 14:16:18 [INFO]: Processing frame 200 (20.51 fps) 2020-09-11 14:16:20 [INFO]: Processing frame 220 (20.59 fps) 2020-09-11 14:16:20 [INFO]: Processing frame 220 (20.59 fps) 2020-09-11 14:16:23 [INFO]: Processing frame 240 (20.62 fps) 2020-09-11 14:16:23 [INFO]: Processing frame 240 (20.62 fps) 2020-09-11 14:16:25 [INFO]: Processing frame 260 (20.62 fps) 2020-09-11 14:16:25 [INFO]: Processing frame 260 (20.62 fps) 2020-09-11 14:16:27 [INFO]: Processing frame 280 (20.65 fps) 2020-09-11 14:16:27 [INFO]: Processing frame 280 (20.65 fps) 2020-09-11 14:16:30 [INFO]: Processing frame 300 (20.72 fps) 2020-09-11 14:16:30 [INFO]: Processing frame 300 (20.72 fps) 2020-09-11 14:16:32 [INFO]: Processing frame 320 (20.79 fps) 2020-09-11 14:16:32 [INFO]: Processing frame 320 (20.79 fps) 2020-09-11 14:16:34 [INFO]: Processing frame 340 (20.85 fps) 2020-09-11 14:16:34 [INFO]: Processing frame 340 (20.85 fps) 2020-09-11 14:16:36 [INFO]: Processing frame 360 (20.91 fps) 2020-09-11 14:16:36 [INFO]: Processing frame 360 (20.91 fps) 2020-09-11 14:16:39 [INFO]: Processing frame 380 (20.94 fps) 2020-09-11 14:16:39 [INFO]: Processing frame 380 (20.94 fps) 2020-09-11 14:16:41 [INFO]: Processing frame 400 (20.93 fps) 2020-09-11 14:16:41 [INFO]: Processing frame 400 (20.93 fps) 2020-09-11 14:16:43 [INFO]: Processing frame 420 (20.94 fps) 2020-09-11 14:16:43 [INFO]: Processing frame 420 (20.94 fps) 2020-09-11 14:16:46 [INFO]: Processing frame 440 (20.95 fps) 2020-09-11 14:16:46 [INFO]: Processing frame 440 (20.95 fps) 2020-09-11 14:16:48 [INFO]: Processing frame 460 (20.98 fps) 2020-09-11 14:16:48 [INFO]: Processing frame 460 (20.98 fps) 2020-09-11 14:16:50 [INFO]: Processing frame 480 (20.98 fps) 2020-09-11 14:16:50 [INFO]: Processing frame 480 (20.98 fps) 2020-09-11 14:16:52 [INFO]: Processing frame 500 (20.99 fps) 2020-09-11 14:16:52 [INFO]: Processing frame 500 (20.99 fps) 2020-09-11 14:16:55 [INFO]: Processing frame 520 (21.00 fps) 2020-09-11 14:16:55 [INFO]: Processing frame 520 (21.00 fps) 2020-09-11 14:16:57 [INFO]: Processing frame 540 (21.03 fps) 2020-09-11 14:16:57 [INFO]: Processing frame 540 (21.03 fps) 2020-09-11 14:16:58 [INFO]: Failed to load frame 547 2020-09-11 14:16:58 [INFO]: Failed to load frame 547 ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 7 (Ubuntu 7.3.0-16ubuntu3) configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Input #0, image2, from '../results/frame/%05d.jpg': Duration: 00:00:21.84, start: 0.000000, bitrate: N/A Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc Please use -b:a or -b:v, -b is ambiguous File '../results/test5_track.mp4' already exists. Overwrite ? [y/N] y y Stream mapping: Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg4 (native)) Press [q] to stop, [?] for help [swscaler @ 0x557f3e66f000] deprecated pixel format used, make sure you did set range correctly Output #0, mp4, to '../results/test5_track.mp4': Metadata: encoder : Lavf57.83.100 Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 25 fps, 12800 tbn, 25 tbc Metadata: encoder : Lavc57.107.100 mpeg4 Side data: cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 0 vbv_delay: -1 frame= 546 fps= 37 q=31.0 Lsize= 13031kB time=00:00:21.80 bitrate=4896.8kbits/s speed=1.49x video:13028kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.025592%
Process finished with exit code 0
以上是我用resdcn_18跑的输出logging。
from future import absolute_import from future import division from future import print_function
import argparse import os
class opts(object): def init(self): self.parser = argparse.ArgumentParser()
# basic experiment setting self.parser.add_argument('--task', default='mot', help='mot') self.parser.add_argument('--dataset', default='jde', help='jde') self.parser.add_argument('--exp_id', default='default') self.parser.add_argument('--test', action='store_true') self.parser.add_argument('--load_model', default='../exp/mot/default/mcmot_last_track_resdcn_18.pth', help='path to pretrained model') self.parser.add_argument('--resume', action='store_true', help='resume an experiment. ' 'Reloaded the optimizer parameter and ' 'set load_model to model_last.pth ' 'in the exp dir if load_model is empty.') # system self.parser.add_argument('--gpus', default='6', # 0, 5, 6 help='-1 for CPU, use comma for multiple gpus') self.parser.add_argument('--num_workers', type=int, default=4, # 8, 6, 4 help='dataloader threads. 0 for single-thread.') self.parser.add_argument('--not_cuda_benchmark', action='store_true', help='disable when the input size is not fixed.') self.parser.add_argument('--seed', type=int, default=317, help='random seed') # from CornerNet self.parser.add_argument('--gen-scale', type=bool, default=True, help='Whether to generate multi-scales') self.parser.add_argument('--is_debug', type=bool, default=False, # 是否使用多线程加载数据, default: False help='whether in debug mode or not') # debug模式下只能使用单进程 # log self.parser.add_argument('--print_iter', type=int, default=0, help='disable progress bar and print to screen.') self.parser.add_argument('--hide_data_time', action='store_true', help='not display time during training.') self.parser.add_argument('--save_all', action='store_true', help='save model to disk every 5 epochs.') self.parser.add_argument('--metric', default='loss', help='main metric to save best model') self.parser.add_argument('--vis_thresh', type=float, default=0.5, help='visualization threshold.') # model: backbone and so on... self.parser.add_argument('--arch', default='resdcn_18', help='model architecture. Currently tested' 'resdcn_18 |resdcn_34 | resdcn_50 | resfpndcn_34 |' 'dla_34 | hrnet_32 | hrnet_18 | cspdarknet_53') self.parser.add_argument('--head_conv', type=int, default=-1, help='conv layer channels for output head' '0 for no conv layer' '-1 for default setting: ' '256 for resnets and 256 for dla.') self.parser.add_argument('--down_ratio', type=int, default=4, # 输出特征图的下采样率 H=H_image/4 and W=W_image/4 help='output stride. Currently only supports 4.') # input self.parser.add_argument('--input_res', type=int, default=-1, help='input height and width. -1 for default from ' 'dataset. Will be overriden by input_h | input_w') self.parser.add_argument('--input_h', type=int, default=-1, help='input height. -1 for default from dataset.') self.parser.add_argument('--input_w', type=int, default=-1, help='input width. -1 for default from dataset.') # train self.parser.add_argument('--lr', type=float, default=7e-5, # 1e-4, 7e-5, 5e-5, 3e-5 help='learning rate for batch size 32.') self.parser.add_argument('--lr_step', type=str, default='10,20', # 20,27 help='drop learning rate by 10.') self.parser.add_argument('--num_epochs', type=int, default=30, # 30, 10, 3, 1 help='total training epochs.') self.parser.add_argument('--batch-size', type=int, default=10, # 18, 16, 14, 12, 10, 8, 4 help='batch size') self.parser.add_argument('--master_batch_size', type=int, default=-1, help='batch size on the master gpu.') self.parser.add_argument('--num_iters', type=int, default=-1, help='default: #samples / batch_size.') self.parser.add_argument('--val_intervals', type=int, default=10, help='number of epochs to run validation.') self.parser.add_argument('--trainval', action='store_true', help='include validation in training and ' 'test on test set') # test self.parser.add_argument('--K', type=int, default=200, # 128 help='max number of output objects.') # 一张图输出检测目标最大数量 self.parser.add_argument('--not_prefetch_test', action='store_true', help='not use parallal data pre-processing.') self.parser.add_argument('--fix_res', action='store_true', help='fix testing resolution or keep ' 'the original resolution') self.parser.add_argument('--keep_res', action='store_true', help='keep the original resolution' ' during validation.') # tracking self.parser.add_argument( '--test_mot16', default=False, help='test mot16') self.parser.add_argument( '--val_mot15', default=False, help='val mot15') self.parser.add_argument( '--test_mot15', default=False, help='test mot15') self.parser.add_argument( '--val_mot16', default=False, help='val mot16 or mot15') self.parser.add_argument( '--test_mot17', default=False, help='test mot17') self.parser.add_argument( '--val_mot17', default=False, help='val mot17') self.parser.add_argument( '--val_mot20', default=False, help='val mot20') self.parser.add_argument( '--test_mot20', default=False, help='test mot20') self.parser.add_argument( '--conf_thres', type=float, default=0.4, # 0.6, 0.4 help='confidence thresh for tracking') # heat-map置信度阈值 self.parser.add_argument('--det_thres', type=float, default=0.3, help='confidence thresh for detection') self.parser.add_argument('--nms_thres', type=float, default=0.4, help='iou thresh for nms') self.parser.add_argument('--track_buffer', type=int, default=30, # 30 help='tracking buffer') self.parser.add_argument('--min-box-area', type=float, default=200, help='filter out tiny boxes') # 测试阶段的输入数据模式: video or image dir self.parser.add_argument('--input-mode', type=str, default='video', # video or image_dir or img_path_list_txt help='input data type(video or image dir)') # 输入的video文件路径 self.parser.add_argument('--input-video', type=str, default='../videos/test5.mp4', help='path to the input video') # 输入的image目录 self.parser.add_argument('--input-img', type=str, default='/users/duanyou/c5/all_pretrain/test.txt', # ../images/ help='path to the input image directory or image file list(.txt)') self.parser.add_argument('--output-format', type=str, default='video', help='video or text') self.parser.add_argument('--output-root', type=str, default='../results', help='expected output root path') # mot: 选择数据集的配置文件 self.parser.add_argument('--data_cfg', type=str, default='../src/lib/cfg/mcmot_det.json', # 'mot15.json', 'visdrone.json' help='load data from cfg') # self.parser.add_argument('--data_cfg', type=str, # default='../src/lib/cfg/mcmot_det.json', # mcmot.json, mcmot_det.json, # help='load data from cfg') self.parser.add_argument('--data_dir', type=str, default='/mnt/diskb/even/dataset') # loss self.parser.add_argument('--mse_loss', # default: false action='store_true', help='use mse loss or focal loss to train ' 'keypoint heatmaps.') self.parser.add_argument('--reg_loss', default='l1', help='regression loss: sl1 | l1 | l2') # sl1: smooth L1 loss self.parser.add_argument('--hm_weight', type=float, default=1, help='loss weight for keypoint heatmaps.') self.parser.add_argument('--off_weight', type=float, default=1, help='loss weight for keypoint local offsets.') self.parser.add_argument('--wh_weight', type=float, default=0.1, help='loss weight for bounding box size.') self.parser.add_argument('--id_loss', default='ce', help='reid loss: ce | triplet') self.parser.add_argument('--id_weight', type=float, default=1, # 0for detection only and 1 for detection and re-ida help='loss weight for id') # ReID feature extraction or not self.parser.add_argument('--reid_dim', type=int, default=128, # 128, 256, 512 help='feature dim for reid') self.parser.add_argument('--input-wh', type=tuple, default=(1088, 608), # (768, 448) or (1088, 608) help='net input resplution') self.parser.add_argument('--multi-scale', type=bool, default=True, help='Whether to use multi-scale training or not') # ----------------------1~10 object classes are what we need # pedestrian (1), --> 0 # people (2), --> 1 # bicycle (3), --> 2 # car (4), --> 3 # van (5), --> 4 # truck (6), --> 5 # tricycle (7), --> 6 # awning-tricycle (8), --> 7 # bus (9), --> 8 # motor (10), --> 9 # ---------------------- # others (11) self.parser.add_argument('--reid_cls_ids', default='0,1,2,3,4', # '0,1,2,3,4' or '0,1,2,3,4,5,6,7,8,9' help='') # the object classes need to do reid self.parser.add_argument('--norm_wh', action='store_true', help='L1(\hat(y) / y, 1) or L1(\hat(y), y)') self.parser.add_argument('--dense_wh', action='store_true', help='apply weighted regression near center or ' 'just apply regression on center point.') self.parser.add_argument('--cat_spec_wh', action='store_true', help='category specific bounding box size.') self.parser.add_argument('--not_reg_offset', action='store_true', help='not regress local offset.') def parse(self, args=''): if args == '': opt = self.parser.parse_args() else: opt = self.parser.parse_args(args) opt.gpus_str = opt.gpus opt.gpus = [int(gpu) for gpu in opt.gpus.split(',')] # opt.gpus = [i for i in range(len(opt.gpus))] if opt.gpus[0] >= 0 else [-1] # print("opt.gpus", opt.gpus) opt.lr_step = [int(i) for i in opt.lr_step.split(',')] opt.fix_res = not opt.keep_res print('Fix size testing.' if opt.fix_res else 'Keep resolution testing.') opt.reg_offset = not opt.not_reg_offset if opt.head_conv == -1: # init default head_conv opt.head_conv = 256 if 'dla' in opt.arch else 256 opt.pad = 31 opt.num_stacks = 1 if opt.trainval: opt.val_intervals = 100000000 if opt.master_batch_size == -1: opt.master_batch_size = opt.batch_size // len(opt.gpus) rest_batch_size = (opt.batch_size - opt.master_batch_size) opt.chunk_sizes = [opt.master_batch_size] for i in range(len(opt.gpus) - 1): slave_chunk_size = rest_batch_size // (len(opt.gpus) - 1) if i < rest_batch_size % (len(opt.gpus) - 1): slave_chunk_size += 1 opt.chunk_sizes.append(slave_chunk_size) print('training chunk_sizes:', opt.chunk_sizes) opt.root_dir = os.path.join(os.path.dirname(__file__), '..', '..') opt.exp_dir = os.path.join(opt.root_dir, 'exp', opt.task) opt.save_dir = os.path.join(opt.exp_dir, opt.exp_id) opt.debug_dir = os.path.join(opt.save_dir, 'debug') print('The output will be saved to ', opt.save_dir) if opt.resume and opt.load_model == '': model_path = opt.save_dir[:-4] if opt.save_dir.endswith('TEST') \ else opt.save_dir opt.load_model = os.path.join(model_path, 'model_last.pth') return opt def update_dataset_info_and_set_heads(self, opt, dataset): """ :param opt: :param dataset: :return: """ input_h, input_w = dataset.default_input_wh # 图片的高和宽 opt.mean, opt.std = dataset.mean, dataset.std # 均值 方差 opt.num_classes = dataset.num_classes # 类别数 for reid_id in opt.reid_cls_ids.split(','): if int(reid_id) > opt.num_classes - 1: print('[Err]: configuration conflict of reid_cls_ids and num_classes!') return # input_h(w): opt.input_h overrides opt.input_res overrides dataset default input_h = opt.input_res if opt.input_res > 0 else input_h input_w = opt.input_res if opt.input_res > 0 else input_w opt.input_h = opt.input_h if opt.input_h > 0 else input_h opt.input_w = opt.input_w if opt.input_w > 0 else input_w opt.output_h = opt.input_h // opt.down_ratio # 输出特征图的宽高 opt.output_w = opt.input_w // opt.down_ratio opt.input_res = max(opt.input_h, opt.input_w) opt.output_res = max(opt.output_h, opt.output_w) if opt.task == 'mot': opt.heads = {'hm': opt.num_classes, 'wh': 2 if not opt.cat_spec_wh else 2 * opt.num_classes, 'id': opt.reid_dim} if opt.reg_offset: opt.heads.update({'reg': 2}) # opt.nID = dataset.nID # @even: 用nID_dict取代nID if opt.id_weight > 0: opt.nID_dict = dataset.nID_dict # opt.img_size = (640, 320) # (1088, 608) else: assert 0, 'task not defined!' print('heads: ', opt.heads) return opt def init(self, args=''): opt = self.parse(args) default_dataset_info = { 'mot': {'default_input_wh': [opt.input_wh[1], opt.input_wh[0]], # [608, 1088], [320, 640] 'num_classes': len(opt.reid_cls_ids.split(',')), # 1 'mean': [0.408, 0.447, 0.470], 'std': [0.289, 0.274, 0.278], 'dataset': 'jde', 'nID': 14455, 'nID_dict': {}}, } class Struct: def __init__(self, entries): for k, v in entries.items(): self.__setattr__(k, v) h_w = default_dataset_info[opt.task]['default_input_wh'] opt.img_size = (h_w[1], h_w[0]) print('Net input image size: {:d}×{:d}'.format(h_w[1], h_w[0])) dataset = Struct(default_dataset_info[opt.task]) opt.dataset = dataset.dataset opt = self.update_dataset_info_and_set_heads(opt, dataset) return opt
这部分是我详细的opt配置文件,刚上传了新代码,你重新下载下来跑一次,我看看logging文件,根据你之前的logging “2020-09-11 11:53:57 [INFO]: unexpected EOF, expected 161141 more bytes. The file might be corrupted. 2020-09-11 11:53:57 [INFO]: unexpected EOF, expected 161141 more bytes. The file might be corrupted.”可能是其他问题。
我目前的调试结果是: 在track.py文件中, tracker = JDETracker(opt, frame_rate=frame_rate) print(tracker,4444444444) timer = Timer()
results_dict = defaultdict(list)
frame_id = 0 # frame index
for path, img, img_0 in data_loader:
#print(path, '33333333333333')
if frame_id % 20 == 0:
logger.info('Processing frame {} ({:.2f} fps)'.format(frame_id, 1.0 / max(1e-5, timer.average_time)))
# --- run tracking
blob = torch.from_numpy(img).unsqueeze(0).to(opt.device)
#print(blob, '4444444444')
if mode == 'track': # process tracking
# ----- track updates of each frame
timer.tic()
print(blob,'111111111133333333')
online_targets_dict = tracker.update_tracking(blob, img_0)
print(blob,'55555555555555')
timer.toc()
然后运行结果是: The output will be saved to /home/sunyue/MCMOT-MCMOT_Visdrone/src/lib/../../exp/mot/default Net input image size: 1088×608 heads: {'hm': 5, 'wh': 2, 'id': 128, 'reg': 2} 2020-09-11 14:28:28 [INFO]: Starting tracking... 2020-09-11 14:28:28 [INFO]: Starting tracking... Lenth of the video: 3250 frames Creating model... loaded ../models/mcmot_last_track_resdcn_18.pth, epoch 9 <lib.tracker.multitracker.JDETracker object at 0x7fd38b635130> 4444444444 2020-09-11 14:28:31 [INFO]: Processing frame 0 (100000.00 fps) 2020-09-11 14:28:31 [INFO]: Processing frame 0 (100000.00 fps) tensor([[[[0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196], [0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196], [0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196], ..., [0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196], [0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196], [0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196]],
[[0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196],
[0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196],
[0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196],
...,
[0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196],
[0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196],
[0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196]],
[[0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196],
[0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196],
[0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196],
...,
[0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196],
[0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196],
[0.50196, 0.50196, 0.50196, ..., 0.50196, 0.50196, 0.50196]]]], device='cuda:0') 111111111133333333
2020-09-11 14:28:31 [INFO]: Integer division of tensors using div or / is no longer supported, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead. 2020-09-11 14:28:31 [INFO]: Integer division of tensors using div or / is no longer supported, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead. ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-10ubuntu2) configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 [image2 @ 0x55f4620eb700] Could find no file with path '../results/frame/%05d.jpg' and index in the range 0-4 ../results/frame/%05d.jpg: No such file or directory 好像是opt设置的不妥,导致online_targets_dict = tracker.update_tracking(blob, img_0)无法正常得到执行得到online_targets_dict 的结果。
ssh://jaya@192.168.1.211:22/usr/bin/python3 -u /mnt/diskb/even/MCMOT/src/demo.py Fix size testing. training chunk_sizes: [10] The output will be saved to /mnt/diskb/even/MCMOT/src/lib/../../exp/mot/default Net input image size: 1088×608 heads: {'hm': 5, 'wh': 2, 'id': 128, 'reg': 2} 2020-09-11 14:15:51 [INFO]: Starting tracking... 2020-09-11 14:15:51 [INFO]: Starting tracking... Lenth of the video: 550 frames Creating model... loaded ../exp/mot/default/mcmot_last_track_resdcn_18.pth, epoch 5 2020-09-11 14:15:54 [INFO]: Processing frame 0 (100000.00 fps) 2020-09-11 14:15:54 [INFO]: Processing frame 0 (100000.00 fps) /pytorch/aten/src/ATen/native/BinaryOps.cpp:81: UserWarning: Integer division of tensors using div or / is deprecated, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead. 2020-09-11 14:15:57 [INFO]: Processing frame 20 (19.12 fps) 2020-09-11 14:15:57 [INFO]: Processing frame 20 (19.12 fps) 2020-09-11 14:15:59 [INFO]: Processing frame 40 (19.37 fps) 2020-09-11 14:15:59 [INFO]: Processing frame 40 (19.37 fps) 2020-09-11 14:16:01 [INFO]: Processing frame 60 (19.74 fps) 2020-09-11 14:16:01 [INFO]: Processing frame 60 (19.74 fps) 2020-09-11 14:16:04 [INFO]: Processing frame 80 (19.95 fps) 2020-09-11 14:16:04 [INFO]: Processing frame 80 (19.95 fps) 2020-09-11 14:16:06 [INFO]: Processing frame 100 (20.22 fps) 2020-09-11 14:16:06 [INFO]: Processing frame 100 (20.22 fps) 2020-09-11 14:16:08 [INFO]: Processing frame 120 (20.42 fps) 2020-09-11 14:16:08 [INFO]: Processing frame 120 (20.42 fps) 2020-09-11 14:16:10 [INFO]: Processing frame 140 (20.48 fps) 2020-09-11 14:16:10 [INFO]: Processing frame 140 (20.48 fps) 2020-09-11 14:16:13 [INFO]: Processing frame 160 (20.48 fps) 2020-09-11 14:16:13 [INFO]: Processing frame 160 (20.48 fps) 2020-09-11 14:16:16 [INFO]: Processing frame 180 (20.44 fps) 2020-09-11 14:16:16 [INFO]: Processing frame 180 (20.44 fps) 2020-09-11 14:16:18 [INFO]: Processing frame 200 (20.51 fps) 2020-09-11 14:16:18 [INFO]: Processing frame 200 (20.51 fps) 2020-09-11 14:16:20 [INFO]: Processing frame 220 (20.59 fps) 2020-09-11 14:16:20 [INFO]: Processing frame 220 (20.59 fps) 2020-09-11 14:16:23 [INFO]: Processing frame 240 (20.62 fps) 2020-09-11 14:16:23 [INFO]: Processing frame 240 (20.62 fps) 2020-09-11 14:16:25 [INFO]: Processing frame 260 (20.62 fps) 2020-09-11 14:16:25 [INFO]: Processing frame 260 (20.62 fps) 2020-09-11 14:16:27 [INFO]: Processing frame 280 (20.65 fps) 2020-09-11 14:16:27 [INFO]: Processing frame 280 (20.65 fps) 2020-09-11 14:16:30 [INFO]: Processing frame 300 (20.72 fps) 2020-09-11 14:16:30 [INFO]: Processing frame 300 (20.72 fps) 2020-09-11 14:16:32 [INFO]: Processing frame 320 (20.79 fps) 2020-09-11 14:16:32 [INFO]: Processing frame 320 (20.79 fps) 2020-09-11 14:16:34 [INFO]: Processing frame 340 (20.85 fps) 2020-09-11 14:16:34 [INFO]: Processing frame 340 (20.85 fps) 2020-09-11 14:16:36 [INFO]: Processing frame 360 (20.91 fps) 2020-09-11 14:16:36 [INFO]: Processing frame 360 (20.91 fps) 2020-09-11 14:16:39 [INFO]: Processing frame 380 (20.94 fps) 2020-09-11 14:16:39 [INFO]: Processing frame 380 (20.94 fps) 2020-09-11 14:16:41 [INFO]: Processing frame 400 (20.93 fps) 2020-09-11 14:16:41 [INFO]: Processing frame 400 (20.93 fps) 2020-09-11 14:16:43 [INFO]: Processing frame 420 (20.94 fps) 2020-09-11 14:16:43 [INFO]: Processing frame 420 (20.94 fps) 2020-09-11 14:16:46 [INFO]: Processing frame 440 (20.95 fps) 2020-09-11 14:16:46 [INFO]: Processing frame 440 (20.95 fps) 2020-09-11 14:16:48 [INFO]: Processing frame 460 (20.98 fps) 2020-09-11 14:16:48 [INFO]: Processing frame 460 (20.98 fps) 2020-09-11 14:16:50 [INFO]: Processing frame 480 (20.98 fps) 2020-09-11 14:16:50 [INFO]: Processing frame 480 (20.98 fps) 2020-09-11 14:16:52 [INFO]: Processing frame 500 (20.99 fps) 2020-09-11 14:16:52 [INFO]: Processing frame 500 (20.99 fps) 2020-09-11 14:16:55 [INFO]: Processing frame 520 (21.00 fps) 2020-09-11 14:16:55 [INFO]: Processing frame 520 (21.00 fps) 2020-09-11 14:16:57 [INFO]: Processing frame 540 (21.03 fps) 2020-09-11 14:16:57 [INFO]: Processing frame 540 (21.03 fps) 2020-09-11 14:16:58 [INFO]: Failed to load frame 547 2020-09-11 14:16:58 [INFO]: Failed to load frame 547 ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 7 (Ubuntu 7.3.0-16ubuntu3) configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Input #0, image2, from '../results/frame/%05d.jpg': Duration: 00:00:21.84, start: 0.000000, bitrate: N/A Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc Please use -b:a or -b:v, -b is ambiguous File '../results/test5_track.mp4' already exists. Overwrite ? [y/N] y y Stream mapping: Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg4 (native)) Press [q] to stop, [?] for help [swscaler @ 0x557f3e66f000] deprecated pixel format used, make sure you did set range correctly Output #0, mp4, to '../results/test5_track.mp4': Metadata: encoder : Lavf57.83.100 Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 25 fps, 12800 tbn, 25 tbc Metadata: encoder : Lavc57.107.100 mpeg4 Side data: cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 0 vbv_delay: -1 frame= 546 fps= 37 q=31.0 Lsize= 13031kB time=00:00:21.80 bitrate=4896.8kbits/s speed=1.49x video:13028kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.025592%
Process finished with exit code 0
以上是我用resdcn_18跑的输出logging。
from future import absolute_import from future import division from future import print_function
import argparse import os
class opts(object): def init(self): self.parser = argparse.ArgumentParser()
# basic experiment setting self.parser.add_argument('--task', default='mot', help='mot') self.parser.add_argument('--dataset', default='jde', help='jde') self.parser.add_argument('--exp_id', default='default') self.parser.add_argument('--test', action='store_true') self.parser.add_argument('--load_model', default='../exp/mot/default/mcmot_last_track_resdcn_18.pth', help='path to pretrained model') self.parser.add_argument('--resume', action='store_true', help='resume an experiment. ' 'Reloaded the optimizer parameter and ' 'set load_model to model_last.pth ' 'in the exp dir if load_model is empty.') # system self.parser.add_argument('--gpus', default='6', # 0, 5, 6 help='-1 for CPU, use comma for multiple gpus') self.parser.add_argument('--num_workers', type=int, default=4, # 8, 6, 4 help='dataloader threads. 0 for single-thread.') self.parser.add_argument('--not_cuda_benchmark', action='store_true', help='disable when the input size is not fixed.') self.parser.add_argument('--seed', type=int, default=317, help='random seed') # from CornerNet self.parser.add_argument('--gen-scale', type=bool, default=True, help='Whether to generate multi-scales') self.parser.add_argument('--is_debug', type=bool, default=False, # 是否使用多线程加载数据, default: False help='whether in debug mode or not') # debug模式下只能使用单进程 # log self.parser.add_argument('--print_iter', type=int, default=0, help='disable progress bar and print to screen.') self.parser.add_argument('--hide_data_time', action='store_true', help='not display time during training.') self.parser.add_argument('--save_all', action='store_true', help='save model to disk every 5 epochs.') self.parser.add_argument('--metric', default='loss', help='main metric to save best model') self.parser.add_argument('--vis_thresh', type=float, default=0.5, help='visualization threshold.') # model: backbone and so on... self.parser.add_argument('--arch', default='resdcn_18', help='model architecture. Currently tested' 'resdcn_18 |resdcn_34 | resdcn_50 | resfpndcn_34 |' 'dla_34 | hrnet_32 | hrnet_18 | cspdarknet_53') self.parser.add_argument('--head_conv', type=int, default=-1, help='conv layer channels for output head' '0 for no conv layer' '-1 for default setting: ' '256 for resnets and 256 for dla.') self.parser.add_argument('--down_ratio', type=int, default=4, # 输出特征图的下采样率 H=H_image/4 and W=W_image/4 help='output stride. Currently only supports 4.') # input self.parser.add_argument('--input_res', type=int, default=-1, help='input height and width. -1 for default from ' 'dataset. Will be overriden by input_h | input_w') self.parser.add_argument('--input_h', type=int, default=-1, help='input height. -1 for default from dataset.') self.parser.add_argument('--input_w', type=int, default=-1, help='input width. -1 for default from dataset.') # train self.parser.add_argument('--lr', type=float, default=7e-5, # 1e-4, 7e-5, 5e-5, 3e-5 help='learning rate for batch size 32.') self.parser.add_argument('--lr_step', type=str, default='10,20', # 20,27 help='drop learning rate by 10.') self.parser.add_argument('--num_epochs', type=int, default=30, # 30, 10, 3, 1 help='total training epochs.') self.parser.add_argument('--batch-size', type=int, default=10, # 18, 16, 14, 12, 10, 8, 4 help='batch size') self.parser.add_argument('--master_batch_size', type=int, default=-1, help='batch size on the master gpu.') self.parser.add_argument('--num_iters', type=int, default=-1, help='default: #samples / batch_size.') self.parser.add_argument('--val_intervals', type=int, default=10, help='number of epochs to run validation.') self.parser.add_argument('--trainval', action='store_true', help='include validation in training and ' 'test on test set') # test self.parser.add_argument('--K', type=int, default=200, # 128 help='max number of output objects.') # 一张图输出检测目标最大数量 self.parser.add_argument('--not_prefetch_test', action='store_true', help='not use parallal data pre-processing.') self.parser.add_argument('--fix_res', action='store_true', help='fix testing resolution or keep ' 'the original resolution') self.parser.add_argument('--keep_res', action='store_true', help='keep the original resolution' ' during validation.') # tracking self.parser.add_argument( '--test_mot16', default=False, help='test mot16') self.parser.add_argument( '--val_mot15', default=False, help='val mot15') self.parser.add_argument( '--test_mot15', default=False, help='test mot15') self.parser.add_argument( '--val_mot16', default=False, help='val mot16 or mot15') self.parser.add_argument( '--test_mot17', default=False, help='test mot17') self.parser.add_argument( '--val_mot17', default=False, help='val mot17') self.parser.add_argument( '--val_mot20', default=False, help='val mot20') self.parser.add_argument( '--test_mot20', default=False, help='test mot20') self.parser.add_argument( '--conf_thres', type=float, default=0.4, # 0.6, 0.4 help='confidence thresh for tracking') # heat-map置信度阈值 self.parser.add_argument('--det_thres', type=float, default=0.3, help='confidence thresh for detection') self.parser.add_argument('--nms_thres', type=float, default=0.4, help='iou thresh for nms') self.parser.add_argument('--track_buffer', type=int, default=30, # 30 help='tracking buffer') self.parser.add_argument('--min-box-area', type=float, default=200, help='filter out tiny boxes') # 测试阶段的输入数据模式: video or image dir self.parser.add_argument('--input-mode', type=str, default='video', # video or image_dir or img_path_list_txt help='input data type(video or image dir)') # 输入的video文件路径 self.parser.add_argument('--input-video', type=str, default='../videos/test5.mp4', help='path to the input video') # 输入的image目录 self.parser.add_argument('--input-img', type=str, default='/users/duanyou/c5/all_pretrain/test.txt', # ../images/ help='path to the input image directory or image file list(.txt)') self.parser.add_argument('--output-format', type=str, default='video', help='video or text') self.parser.add_argument('--output-root', type=str, default='../results', help='expected output root path') # mot: 选择数据集的配置文件 self.parser.add_argument('--data_cfg', type=str, default='../src/lib/cfg/mcmot_det.json', # 'mot15.json', 'visdrone.json' help='load data from cfg') # self.parser.add_argument('--data_cfg', type=str, # default='../src/lib/cfg/mcmot_det.json', # mcmot.json, mcmot_det.json, # help='load data from cfg') self.parser.add_argument('--data_dir', type=str, default='/mnt/diskb/even/dataset') # loss self.parser.add_argument('--mse_loss', # default: false action='store_true', help='use mse loss or focal loss to train ' 'keypoint heatmaps.') self.parser.add_argument('--reg_loss', default='l1', help='regression loss: sl1 | l1 | l2') # sl1: smooth L1 loss self.parser.add_argument('--hm_weight', type=float, default=1, help='loss weight for keypoint heatmaps.') self.parser.add_argument('--off_weight', type=float, default=1, help='loss weight for keypoint local offsets.') self.parser.add_argument('--wh_weight', type=float, default=0.1, help='loss weight for bounding box size.') self.parser.add_argument('--id_loss', default='ce', help='reid loss: ce | triplet') self.parser.add_argument('--id_weight', type=float, default=1, # 0for detection only and 1 for detection and re-ida help='loss weight for id') # ReID feature extraction or not self.parser.add_argument('--reid_dim', type=int, default=128, # 128, 256, 512 help='feature dim for reid') self.parser.add_argument('--input-wh', type=tuple, default=(1088, 608), # (768, 448) or (1088, 608) help='net input resplution') self.parser.add_argument('--multi-scale', type=bool, default=True, help='Whether to use multi-scale training or not') # ----------------------1~10 object classes are what we need # pedestrian (1), --> 0 # people (2), --> 1 # bicycle (3), --> 2 # car (4), --> 3 # van (5), --> 4 # truck (6), --> 5 # tricycle (7), --> 6 # awning-tricycle (8), --> 7 # bus (9), --> 8 # motor (10), --> 9 # ---------------------- # others (11) self.parser.add_argument('--reid_cls_ids', default='0,1,2,3,4', # '0,1,2,3,4' or '0,1,2,3,4,5,6,7,8,9' help='') # the object classes need to do reid self.parser.add_argument('--norm_wh', action='store_true', help='L1(\hat(y) / y, 1) or L1(\hat(y), y)') self.parser.add_argument('--dense_wh', action='store_true', help='apply weighted regression near center or ' 'just apply regression on center point.') self.parser.add_argument('--cat_spec_wh', action='store_true', help='category specific bounding box size.') self.parser.add_argument('--not_reg_offset', action='store_true', help='not regress local offset.') def parse(self, args=''): if args == '': opt = self.parser.parse_args() else: opt = self.parser.parse_args(args) opt.gpus_str = opt.gpus opt.gpus = [int(gpu) for gpu in opt.gpus.split(',')] # opt.gpus = [i for i in range(len(opt.gpus))] if opt.gpus[0] >= 0 else [-1] # print("opt.gpus", opt.gpus) opt.lr_step = [int(i) for i in opt.lr_step.split(',')] opt.fix_res = not opt.keep_res print('Fix size testing.' if opt.fix_res else 'Keep resolution testing.') opt.reg_offset = not opt.not_reg_offset if opt.head_conv == -1: # init default head_conv opt.head_conv = 256 if 'dla' in opt.arch else 256 opt.pad = 31 opt.num_stacks = 1 if opt.trainval: opt.val_intervals = 100000000 if opt.master_batch_size == -1: opt.master_batch_size = opt.batch_size // len(opt.gpus) rest_batch_size = (opt.batch_size - opt.master_batch_size) opt.chunk_sizes = [opt.master_batch_size] for i in range(len(opt.gpus) - 1): slave_chunk_size = rest_batch_size // (len(opt.gpus) - 1) if i < rest_batch_size % (len(opt.gpus) - 1): slave_chunk_size += 1 opt.chunk_sizes.append(slave_chunk_size) print('training chunk_sizes:', opt.chunk_sizes) opt.root_dir = os.path.join(os.path.dirname(__file__), '..', '..') opt.exp_dir = os.path.join(opt.root_dir, 'exp', opt.task) opt.save_dir = os.path.join(opt.exp_dir, opt.exp_id) opt.debug_dir = os.path.join(opt.save_dir, 'debug') print('The output will be saved to ', opt.save_dir) if opt.resume and opt.load_model == '': model_path = opt.save_dir[:-4] if opt.save_dir.endswith('TEST') \ else opt.save_dir opt.load_model = os.path.join(model_path, 'model_last.pth') return opt def update_dataset_info_and_set_heads(self, opt, dataset): """ :param opt: :param dataset: :return: """ input_h, input_w = dataset.default_input_wh # 图片的高和宽 opt.mean, opt.std = dataset.mean, dataset.std # 均值 方差 opt.num_classes = dataset.num_classes # 类别数 for reid_id in opt.reid_cls_ids.split(','): if int(reid_id) > opt.num_classes - 1: print('[Err]: configuration conflict of reid_cls_ids and num_classes!') return # input_h(w): opt.input_h overrides opt.input_res overrides dataset default input_h = opt.input_res if opt.input_res > 0 else input_h input_w = opt.input_res if opt.input_res > 0 else input_w opt.input_h = opt.input_h if opt.input_h > 0 else input_h opt.input_w = opt.input_w if opt.input_w > 0 else input_w opt.output_h = opt.input_h // opt.down_ratio # 输出特征图的宽高 opt.output_w = opt.input_w // opt.down_ratio opt.input_res = max(opt.input_h, opt.input_w) opt.output_res = max(opt.output_h, opt.output_w) if opt.task == 'mot': opt.heads = {'hm': opt.num_classes, 'wh': 2 if not opt.cat_spec_wh else 2 * opt.num_classes, 'id': opt.reid_dim} if opt.reg_offset: opt.heads.update({'reg': 2}) # opt.nID = dataset.nID # @even: 用nID_dict取代nID if opt.id_weight > 0: opt.nID_dict = dataset.nID_dict # opt.img_size = (640, 320) # (1088, 608) else: assert 0, 'task not defined!' print('heads: ', opt.heads) return opt def init(self, args=''): opt = self.parse(args) default_dataset_info = { 'mot': {'default_input_wh': [opt.input_wh[1], opt.input_wh[0]], # [608, 1088], [320, 640] 'num_classes': len(opt.reid_cls_ids.split(',')), # 1 'mean': [0.408, 0.447, 0.470], 'std': [0.289, 0.274, 0.278], 'dataset': 'jde', 'nID': 14455, 'nID_dict': {}}, } class Struct: def __init__(self, entries): for k, v in entries.items(): self.__setattr__(k, v) h_w = default_dataset_info[opt.task]['default_input_wh'] opt.img_size = (h_w[1], h_w[0]) print('Net input image size: {:d}×{:d}'.format(h_w[1], h_w[0])) dataset = Struct(default_dataset_info[opt.task]) opt.dataset = dataset.dataset opt = self.update_dataset_info_and_set_heads(opt, dataset) return opt
这部分是我详细的opt配置文件,刚上传了新代码,你重新下载下来跑一次,我看看logging文件,根据你之前的logging “2020-09-11 11:53:57 [INFO]: unexpected EOF, expected 161141 more bytes. The file might be corrupted. 2020-09-11 11:53:57 [INFO]: unexpected EOF, expected 161141 more bytes. The file might be corrupted.”可能是其他问题。
我下载了你更新的源码,结果还是这样,T_T: Fix size testing. training chunk_sizes: [10] The output will be saved to /home/sunyue/MCMOT-MCMOT_Visdrone/src/lib/../../exp/mot/default Net input image size: 1088×608 heads: {'hm': 5, 'wh': 2, 'id': 128, 'reg': 2} 2020-09-11 14:39:49 [INFO]: Starting tracking... 2020-09-11 14:39:49 [INFO]: Starting tracking... Lenth of the video: 3250 frames Creating model... loaded ../models/mcmot_last_track_resdcn_18.pth, epoch 9 2020-09-11 14:39:51 [INFO]: Processing frame 0 (100000.00 fps) 2020-09-11 14:39:51 [INFO]: Processing frame 0 (100000.00 fps) 2020-09-11 14:39:51 [INFO]: Integer division of tensors using div or / is no longer supported, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead. 2020-09-11 14:39:51 [INFO]: Integer division of tensors using div or / is no longer supported, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead. ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-10ubuntu2) configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 [image2 @ 0x559882f69700] Could find no file with path '../results/frame/%05d.jpg' and index in the range 0-4 ../results/frame/%05d.jpg: No such file or directory
目前得到的结论是,无法在frame文件中生成追踪的结果,上面的调试,哪一行得不到结果,我也用的你的mcmot_last_track_resdcn_18
@starsky68 你输入的video共享出来,我这边跑跑看?
@starsky68 你输入的video共享出来,我这边跑跑看?
我试了多个video都不行,其中一个是MOT16-03。
我跑了一个MOT的测试video是没有问题的.....
@starsky68 我说错的,我刚才跑的就是Visdrone版本分支,应该是没问题的
我跑了一个MOT的测试video是没有问题的.....
我找到了master版本了,我再试一下
@starsky68 我说错的,我刚才跑的就是Visdrone版本分支,应该是没问题的
请问, device = torch.device('cuda: 0' if torch.cuda.is_available() else 'cpu') (1)
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') (2)
请问第一和第二种写法会导致什么结果,第一种结果报错: RuntimeError: Invalid device string: 'cuda: 0' 无论是我把0换成1,2,3都不行,因为我这里只有四块显卡,我就换成了第二种写法。
@starsky68
my_visible_devs = '5' # '0, 3' # 设置可运行GPU编号
os.environ['CUDA_VISIBLE_DEVICES'] = my_visible_devs
device = torch.device('cuda: 0' if torch.cuda.is_available() else 'cpu')
按照这样写就可以,5可以换成0~3
@starsky68
my_visible_devs = '5' # '0, 3' # 设置可运行GPU编号 os.environ['CUDA_VISIBLE_DEVICES'] = my_visible_devs device = torch.device('cuda: 0' if torch.cuda.is_available() else 'cpu')
按照这样写就可以,5可以换成0~3
我清楚这个参数my_visible_devs是指定显卡的,但是下面这个:
device = torch.device('cuda: 0' if torch.cuda.is_available() else 'cpu')
一直报错:
File "demo.py", line 13, in
在我的环境里,在decode.py中的: def _topk(heatmap, K=40, num_classes=1): """ scores=heatmap by default """ N, C, H, W = heatmap.size()
# 2d feature map -> 1d feature map
topk_scores, topk_inds = torch.topk(heatmap.view(N, C, -1), K)
#print(topk_inds,'444444444444')
topk_inds = topk_inds % (H * W) # 这一步貌似没必要...
# print("topk_inds.shape: ", topk_inds.shape) # 1×1×128
#print(topk_inds,'66666666')
topk_ys = torch.true_divide(topk_inds , W)
topk_xs = (topk_inds % W).int().float()
#print(topk_xs,'6666666666')
topk_score, topk_ind = torch.topk(topk_scores.view(N, -1), K)
#print(topk_ind,'66666666')
topk_clses = torch.true_divide(topk_ind , K)
# print("topk_clses.shape", topk_clses.shape) # 1×128
#print(topk_clses,'777777777777')
topk_inds = _gather_feat(topk_inds.view(N, -1, 1), topk_ind).view(N, K) # 1×128×1 -> 1×128?
topk_ys = _gather_feat(topk_ys.view(N, -1, 1), topk_ind).view(N, K)
topk_xs = _gather_feat(topk_xs.view(N, -1, 1), topk_ind).view(N, K)
必须这样才会有最终的输出值
请问,你的torch版本是多少 @CaptainEven
我这里出现这个问题: THCudaCheck FAIL file=/opt/conda/conda-bld/pytorch_1595629403081/work/aten/src/THC/THCGeneral.cpp line=47 error=100 : no CUDA-capable device is detected terminate called after throwing an instance of 'std::runtime_error' what(): cuda runtime error (100) : no CUDA-capable device is detected at /opt/conda/conda-bld/pytorch_1595629403081/work/aten/src/THC/THCGeneral.cpp:47 Aborted (core dumped)
@CaptainEven 我的是这样改,上面是decode.py的修改,这次是multitracker.py的修改,具体为: top, bottom = np.round(pad_y - 0.1), np.round(pad_y + 0.1) left, right = np.round(pad_x - 0.1), np.round(pad_x + 0.1)
if pad_type == 'pad_x': dets[:, 0] = (torch.from_numpy(dets[:, 0]) - pad_1) / new_shape[0] w_orig # x1 dets[:, 2] = (torch.from_numpy(dets[:, 2]) - pad_1) / new_shape[0] w_orig # x2 dets[:, 1] = dets[:, 1] / h_out h_orig # y1 dets[:, 3] = dets[:, 3] / h_out h_orig # y2
print(dets[:, 0],'5555555555')
else: # 'pad_y' dets[:, 0] = dets[:, 0] / w_out w_orig # x1 dets[:, 2] = dets[:, 2] / w_out w_orig # x2 dets[:, 1] = (torch.from_numpy(dets[:, 1]) - pad_1) / new_shape[1] h_orig # y1 dets[:, 3] = (torch.from_numpy(dets[:, 3]) - pad_1) / new_shape[1] h_orig # y2
print(dets[:, 3],'77777777777777')
修改后,可以正常运行了。
Fix size testing. training chunk_sizes: [16] The output will be saved to /home/wudashuo/code/MCMOT-master/src/lib/../../exp/mot/default Net input image H, W [608, 1088] heads: {'hm': 5, 'wh': 2, 'id': 128, 'reg': 2} 2020-09-12 16:11:02 [INFO]: Starting tracking... 2020-09-12 16:11:02 [INFO]: Starting tracking... Lenth of the video: 1500 frames Creating model... loaded ../models/mcmot_last_track_resdcn_18.pth, epoch 9 2020-09-12 16:11:04 [INFO]: Processing frame 0 (100000.00 fps) 2020-09-12 16:11:04 [INFO]: Processing frame 0 (100000.00 fps) /home/wudashuo/code/MCMOT-master/src/lib/tracker/multitracker.py:164: RuntimeWarning: divide by zero encountered in double_scalars ret[2] /= ret[3] /home/wudashuo/code/MCMOT-master/src/lib/tracker/multitracker.py:142: RuntimeWarning: invalid value encountered in double_scalars ret[2] *= ret[3] 2020-09-12 16:11:07 [INFO]: Processing frame 20 (27.47 fps) 2020-09-12 16:11:07 [INFO]: Processing frame 20 (27.47 fps) 2020-09-12 16:11:09 [INFO]: Processing frame 40 (28.05 fps) 2020-09-12 16:11:09 [INFO]: Processing frame 40 (28.05 fps) 2020-09-12 16:11:12 [INFO]: Processing frame 60 (28.27 fps) 2020-09-12 16:11:12 [INFO]: Processing frame 60 (28.27 fps) 2020-09-12 16:11:14 [INFO]: Processing frame 80 (28.57 fps) 2020-09-12 16:11:14 [INFO]: Processing frame 80 (28.57 fps)
ssh://jaya@192.168.1.211:22/usr/bin/python3 -u /mnt/diskb/even/MCMOT/src/demo.py Fix size testing. training chunk_sizes: [10] The output will be saved to /mnt/diskb/even/MCMOT/src/lib/../../exp/mot/default Net input image size: 1088×608 heads: {'hm': 5, 'wh': 2, 'id': 128, 'reg': 2} 2020-09-11 14:15:51 [INFO]: Starting tracking... 2020-09-11 14:15:51 [INFO]: Starting tracking... Lenth of the video: 550 frames Creating model... loaded ../exp/mot/default/mcmot_last_track_resdcn_18.pth, epoch 5 2020-09-11 14:15:54 [INFO]: Processing frame 0 (100000.00 fps) 2020-09-11 14:15:54 [INFO]: Processing frame 0 (100000.00 fps) /pytorch/aten/src/ATen/native/BinaryOps.cpp:81: UserWarning: Integer division of tensors using div or / is deprecated, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead. 2020-09-11 14:15:57 [INFO]: Processing frame 20 (19.12 fps) 2020-09-11 14:15:57 [INFO]: Processing frame 20 (19.12 fps) 2020-09-11 14:15:59 [INFO]: Processing frame 40 (19.37 fps) 2020-09-11 14:15:59 [INFO]: Processing frame 40 (19.37 fps) 2020-09-11 14:16:01 [INFO]: Processing frame 60 (19.74 fps) 2020-09-11 14:16:01 [INFO]: Processing frame 60 (19.74 fps) 2020-09-11 14:16:04 [INFO]: Processing frame 80 (19.95 fps) 2020-09-11 14:16:04 [INFO]: Processing frame 80 (19.95 fps) 2020-09-11 14:16:06 [INFO]: Processing frame 100 (20.22 fps) 2020-09-11 14:16:06 [INFO]: Processing frame 100 (20.22 fps) 2020-09-11 14:16:08 [INFO]: Processing frame 120 (20.42 fps) 2020-09-11 14:16:08 [INFO]: Processing frame 120 (20.42 fps) 2020-09-11 14:16:10 [INFO]: Processing frame 140 (20.48 fps) 2020-09-11 14:16:10 [INFO]: Processing frame 140 (20.48 fps) 2020-09-11 14:16:13 [INFO]: Processing frame 160 (20.48 fps) 2020-09-11 14:16:13 [INFO]: Processing frame 160 (20.48 fps) 2020-09-11 14:16:16 [INFO]: Processing frame 180 (20.44 fps) 2020-09-11 14:16:16 [INFO]: Processing frame 180 (20.44 fps) 2020-09-11 14:16:18 [INFO]: Processing frame 200 (20.51 fps) 2020-09-11 14:16:18 [INFO]: Processing frame 200 (20.51 fps) 2020-09-11 14:16:20 [INFO]: Processing frame 220 (20.59 fps) 2020-09-11 14:16:20 [INFO]: Processing frame 220 (20.59 fps) 2020-09-11 14:16:23 [INFO]: Processing frame 240 (20.62 fps) 2020-09-11 14:16:23 [INFO]: Processing frame 240 (20.62 fps) 2020-09-11 14:16:25 [INFO]: Processing frame 260 (20.62 fps) 2020-09-11 14:16:25 [INFO]: Processing frame 260 (20.62 fps) 2020-09-11 14:16:27 [INFO]: Processing frame 280 (20.65 fps) 2020-09-11 14:16:27 [INFO]: Processing frame 280 (20.65 fps) 2020-09-11 14:16:30 [INFO]: Processing frame 300 (20.72 fps) 2020-09-11 14:16:30 [INFO]: Processing frame 300 (20.72 fps) 2020-09-11 14:16:32 [INFO]: Processing frame 320 (20.79 fps) 2020-09-11 14:16:32 [INFO]: Processing frame 320 (20.79 fps) 2020-09-11 14:16:34 [INFO]: Processing frame 340 (20.85 fps) 2020-09-11 14:16:34 [INFO]: Processing frame 340 (20.85 fps) 2020-09-11 14:16:36 [INFO]: Processing frame 360 (20.91 fps) 2020-09-11 14:16:36 [INFO]: Processing frame 360 (20.91 fps) 2020-09-11 14:16:39 [INFO]: Processing frame 380 (20.94 fps) 2020-09-11 14:16:39 [INFO]: Processing frame 380 (20.94 fps) 2020-09-11 14:16:41 [INFO]: Processing frame 400 (20.93 fps) 2020-09-11 14:16:41 [INFO]: Processing frame 400 (20.93 fps) 2020-09-11 14:16:43 [INFO]: Processing frame 420 (20.94 fps) 2020-09-11 14:16:43 [INFO]: Processing frame 420 (20.94 fps) 2020-09-11 14:16:46 [INFO]: Processing frame 440 (20.95 fps) 2020-09-11 14:16:46 [INFO]: Processing frame 440 (20.95 fps) 2020-09-11 14:16:48 [INFO]: Processing frame 460 (20.98 fps) 2020-09-11 14:16:48 [INFO]: Processing frame 460 (20.98 fps) 2020-09-11 14:16:50 [INFO]: Processing frame 480 (20.98 fps) 2020-09-11 14:16:50 [INFO]: Processing frame 480 (20.98 fps) 2020-09-11 14:16:52 [INFO]: Processing frame 500 (20.99 fps) 2020-09-11 14:16:52 [INFO]: Processing frame 500 (20.99 fps) 2020-09-11 14:16:55 [INFO]: Processing frame 520 (21.00 fps) 2020-09-11 14:16:55 [INFO]: Processing frame 520 (21.00 fps) 2020-09-11 14:16:57 [INFO]: Processing frame 540 (21.03 fps) 2020-09-11 14:16:57 [INFO]: Processing frame 540 (21.03 fps) 2020-09-11 14:16:58 [INFO]: Failed to load frame 547 2020-09-11 14:16:58 [INFO]: Failed to load frame 547 ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 7 (Ubuntu 7.3.0-16ubuntu3) configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Input #0, image2, from '../results/frame/%05d.jpg': Duration: 00:00:21.84, start: 0.000000, bitrate: N/A Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc Please use -b:a or -b:v, -b is ambiguous File '../results/test5_track.mp4' already exists. Overwrite ? [y/N] y y Stream mapping: Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg4 (native)) Press [q] to stop, [?] for help [swscaler @ 0x557f3e66f000] deprecated pixel format used, make sure you did set range correctly Output #0, mp4, to '../results/test5_track.mp4': Metadata: encoder : Lavf57.83.100 Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 5000 kb/s, 25 fps, 12800 tbn, 25 tbc Metadata: encoder : Lavc57.107.100 mpeg4 Side data: cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 0 vbv_delay: -1 frame= 546 fps= 37 q=31.0 Lsize= 13031kB time=00:00:21.80 bitrate=4896.8kbits/s speed=1.49x video:13028kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.025592%
Process finished with exit code 0
以上是我用resdcn_18跑的输出logging。
from future import absolute_import from future import division from future import print_function
import argparse import os
class opts(object): def init(self): self.parser = argparse.ArgumentParser()
# basic experiment setting self.parser.add_argument('--task', default='mot', help='mot') self.parser.add_argument('--dataset', default='jde', help='jde') self.parser.add_argument('--exp_id', default='default') self.parser.add_argument('--test', action='store_true') self.parser.add_argument('--load_model', default='../exp/mot/default/mcmot_last_track_resdcn_18.pth', help='path to pretrained model') self.parser.add_argument('--resume', action='store_true', help='resume an experiment. ' 'Reloaded the optimizer parameter and ' 'set load_model to model_last.pth ' 'in the exp dir if load_model is empty.') # system self.parser.add_argument('--gpus', default='6', # 0, 5, 6 help='-1 for CPU, use comma for multiple gpus') self.parser.add_argument('--num_workers', type=int, default=4, # 8, 6, 4 help='dataloader threads. 0 for single-thread.') self.parser.add_argument('--not_cuda_benchmark', action='store_true', help='disable when the input size is not fixed.') self.parser.add_argument('--seed', type=int, default=317, help='random seed') # from CornerNet self.parser.add_argument('--gen-scale', type=bool, default=True, help='Whether to generate multi-scales') self.parser.add_argument('--is_debug', type=bool, default=False, # 是否使用多线程加载数据, default: False help='whether in debug mode or not') # debug模式下只能使用单进程 # log self.parser.add_argument('--print_iter', type=int, default=0, help='disable progress bar and print to screen.') self.parser.add_argument('--hide_data_time', action='store_true', help='not display time during training.') self.parser.add_argument('--save_all', action='store_true', help='save model to disk every 5 epochs.') self.parser.add_argument('--metric', default='loss', help='main metric to save best model') self.parser.add_argument('--vis_thresh', type=float, default=0.5, help='visualization threshold.') # model: backbone and so on... self.parser.add_argument('--arch', default='resdcn_18', help='model architecture. Currently tested' 'resdcn_18 |resdcn_34 | resdcn_50 | resfpndcn_34 |' 'dla_34 | hrnet_32 | hrnet_18 | cspdarknet_53') self.parser.add_argument('--head_conv', type=int, default=-1, help='conv layer channels for output head' '0 for no conv layer' '-1 for default setting: ' '256 for resnets and 256 for dla.') self.parser.add_argument('--down_ratio', type=int, default=4, # 输出特征图的下采样率 H=H_image/4 and W=W_image/4 help='output stride. Currently only supports 4.') # input self.parser.add_argument('--input_res', type=int, default=-1, help='input height and width. -1 for default from ' 'dataset. Will be overriden by input_h | input_w') self.parser.add_argument('--input_h', type=int, default=-1, help='input height. -1 for default from dataset.') self.parser.add_argument('--input_w', type=int, default=-1, help='input width. -1 for default from dataset.') # train self.parser.add_argument('--lr', type=float, default=7e-5, # 1e-4, 7e-5, 5e-5, 3e-5 help='learning rate for batch size 32.') self.parser.add_argument('--lr_step', type=str, default='10,20', # 20,27 help='drop learning rate by 10.') self.parser.add_argument('--num_epochs', type=int, default=30, # 30, 10, 3, 1 help='total training epochs.') self.parser.add_argument('--batch-size', type=int, default=10, # 18, 16, 14, 12, 10, 8, 4 help='batch size') self.parser.add_argument('--master_batch_size', type=int, default=-1, help='batch size on the master gpu.') self.parser.add_argument('--num_iters', type=int, default=-1, help='default: #samples / batch_size.') self.parser.add_argument('--val_intervals', type=int, default=10, help='number of epochs to run validation.') self.parser.add_argument('--trainval', action='store_true', help='include validation in training and ' 'test on test set') # test self.parser.add_argument('--K', type=int, default=200, # 128 help='max number of output objects.') # 一张图输出检测目标最大数量 self.parser.add_argument('--not_prefetch_test', action='store_true', help='not use parallal data pre-processing.') self.parser.add_argument('--fix_res', action='store_true', help='fix testing resolution or keep ' 'the original resolution') self.parser.add_argument('--keep_res', action='store_true', help='keep the original resolution' ' during validation.') # tracking self.parser.add_argument( '--test_mot16', default=False, help='test mot16') self.parser.add_argument( '--val_mot15', default=False, help='val mot15') self.parser.add_argument( '--test_mot15', default=False, help='test mot15') self.parser.add_argument( '--val_mot16', default=False, help='val mot16 or mot15') self.parser.add_argument( '--test_mot17', default=False, help='test mot17') self.parser.add_argument( '--val_mot17', default=False, help='val mot17') self.parser.add_argument( '--val_mot20', default=False, help='val mot20') self.parser.add_argument( '--test_mot20', default=False, help='test mot20') self.parser.add_argument( '--conf_thres', type=float, default=0.4, # 0.6, 0.4 help='confidence thresh for tracking') # heat-map置信度阈值 self.parser.add_argument('--det_thres', type=float, default=0.3, help='confidence thresh for detection') self.parser.add_argument('--nms_thres', type=float, default=0.4, help='iou thresh for nms') self.parser.add_argument('--track_buffer', type=int, default=30, # 30 help='tracking buffer') self.parser.add_argument('--min-box-area', type=float, default=200, help='filter out tiny boxes') # 测试阶段的输入数据模式: video or image dir self.parser.add_argument('--input-mode', type=str, default='video', # video or image_dir or img_path_list_txt help='input data type(video or image dir)') # 输入的video文件路径 self.parser.add_argument('--input-video', type=str, default='../videos/test5.mp4', help='path to the input video') # 输入的image目录 self.parser.add_argument('--input-img', type=str, default='/users/duanyou/c5/all_pretrain/test.txt', # ../images/ help='path to the input image directory or image file list(.txt)') self.parser.add_argument('--output-format', type=str, default='video', help='video or text') self.parser.add_argument('--output-root', type=str, default='../results', help='expected output root path') # mot: 选择数据集的配置文件 self.parser.add_argument('--data_cfg', type=str, default='../src/lib/cfg/mcmot_det.json', # 'mot15.json', 'visdrone.json' help='load data from cfg') # self.parser.add_argument('--data_cfg', type=str, # default='../src/lib/cfg/mcmot_det.json', # mcmot.json, mcmot_det.json, # help='load data from cfg') self.parser.add_argument('--data_dir', type=str, default='/mnt/diskb/even/dataset') # loss self.parser.add_argument('--mse_loss', # default: false action='store_true', help='use mse loss or focal loss to train ' 'keypoint heatmaps.') self.parser.add_argument('--reg_loss', default='l1', help='regression loss: sl1 | l1 | l2') # sl1: smooth L1 loss self.parser.add_argument('--hm_weight', type=float, default=1, help='loss weight for keypoint heatmaps.') self.parser.add_argument('--off_weight', type=float, default=1, help='loss weight for keypoint local offsets.') self.parser.add_argument('--wh_weight', type=float, default=0.1, help='loss weight for bounding box size.') self.parser.add_argument('--id_loss', default='ce', help='reid loss: ce | triplet') self.parser.add_argument('--id_weight', type=float, default=1, # 0for detection only and 1 for detection and re-ida help='loss weight for id') # ReID feature extraction or not self.parser.add_argument('--reid_dim', type=int, default=128, # 128, 256, 512 help='feature dim for reid') self.parser.add_argument('--input-wh', type=tuple, default=(1088, 608), # (768, 448) or (1088, 608) help='net input resplution') self.parser.add_argument('--multi-scale', type=bool, default=True, help='Whether to use multi-scale training or not') # ----------------------1~10 object classes are what we need # pedestrian (1), --> 0 # people (2), --> 1 # bicycle (3), --> 2 # car (4), --> 3 # van (5), --> 4 # truck (6), --> 5 # tricycle (7), --> 6 # awning-tricycle (8), --> 7 # bus (9), --> 8 # motor (10), --> 9 # ---------------------- # others (11) self.parser.add_argument('--reid_cls_ids', default='0,1,2,3,4', # '0,1,2,3,4' or '0,1,2,3,4,5,6,7,8,9' help='') # the object classes need to do reid self.parser.add_argument('--norm_wh', action='store_true', help='L1(\hat(y) / y, 1) or L1(\hat(y), y)') self.parser.add_argument('--dense_wh', action='store_true', help='apply weighted regression near center or ' 'just apply regression on center point.') self.parser.add_argument('--cat_spec_wh', action='store_true', help='category specific bounding box size.') self.parser.add_argument('--not_reg_offset', action='store_true', help='not regress local offset.') def parse(self, args=''): if args == '': opt = self.parser.parse_args() else: opt = self.parser.parse_args(args) opt.gpus_str = opt.gpus opt.gpus = [int(gpu) for gpu in opt.gpus.split(',')] # opt.gpus = [i for i in range(len(opt.gpus))] if opt.gpus[0] >= 0 else [-1] # print("opt.gpus", opt.gpus) opt.lr_step = [int(i) for i in opt.lr_step.split(',')] opt.fix_res = not opt.keep_res print('Fix size testing.' if opt.fix_res else 'Keep resolution testing.') opt.reg_offset = not opt.not_reg_offset if opt.head_conv == -1: # init default head_conv opt.head_conv = 256 if 'dla' in opt.arch else 256 opt.pad = 31 opt.num_stacks = 1 if opt.trainval: opt.val_intervals = 100000000 if opt.master_batch_size == -1: opt.master_batch_size = opt.batch_size // len(opt.gpus) rest_batch_size = (opt.batch_size - opt.master_batch_size) opt.chunk_sizes = [opt.master_batch_size] for i in range(len(opt.gpus) - 1): slave_chunk_size = rest_batch_size // (len(opt.gpus) - 1) if i < rest_batch_size % (len(opt.gpus) - 1): slave_chunk_size += 1 opt.chunk_sizes.append(slave_chunk_size) print('training chunk_sizes:', opt.chunk_sizes) opt.root_dir = os.path.join(os.path.dirname(__file__), '..', '..') opt.exp_dir = os.path.join(opt.root_dir, 'exp', opt.task) opt.save_dir = os.path.join(opt.exp_dir, opt.exp_id) opt.debug_dir = os.path.join(opt.save_dir, 'debug') print('The output will be saved to ', opt.save_dir) if opt.resume and opt.load_model == '': model_path = opt.save_dir[:-4] if opt.save_dir.endswith('TEST') \ else opt.save_dir opt.load_model = os.path.join(model_path, 'model_last.pth') return opt def update_dataset_info_and_set_heads(self, opt, dataset): """ :param opt: :param dataset: :return: """ input_h, input_w = dataset.default_input_wh # 图片的高和宽 opt.mean, opt.std = dataset.mean, dataset.std # 均值 方差 opt.num_classes = dataset.num_classes # 类别数 for reid_id in opt.reid_cls_ids.split(','): if int(reid_id) > opt.num_classes - 1: print('[Err]: configuration conflict of reid_cls_ids and num_classes!') return # input_h(w): opt.input_h overrides opt.input_res overrides dataset default input_h = opt.input_res if opt.input_res > 0 else input_h input_w = opt.input_res if opt.input_res > 0 else input_w opt.input_h = opt.input_h if opt.input_h > 0 else input_h opt.input_w = opt.input_w if opt.input_w > 0 else input_w opt.output_h = opt.input_h // opt.down_ratio # 输出特征图的宽高 opt.output_w = opt.input_w // opt.down_ratio opt.input_res = max(opt.input_h, opt.input_w) opt.output_res = max(opt.output_h, opt.output_w) if opt.task == 'mot': opt.heads = {'hm': opt.num_classes, 'wh': 2 if not opt.cat_spec_wh else 2 * opt.num_classes, 'id': opt.reid_dim} if opt.reg_offset: opt.heads.update({'reg': 2}) # opt.nID = dataset.nID # @even: 用nID_dict取代nID if opt.id_weight > 0: opt.nID_dict = dataset.nID_dict # opt.img_size = (640, 320) # (1088, 608) else: assert 0, 'task not defined!' print('heads: ', opt.heads) return opt def init(self, args=''): opt = self.parse(args) default_dataset_info = { 'mot': {'default_input_wh': [opt.input_wh[1], opt.input_wh[0]], # [608, 1088], [320, 640] 'num_classes': len(opt.reid_cls_ids.split(',')), # 1 'mean': [0.408, 0.447, 0.470], 'std': [0.289, 0.274, 0.278], 'dataset': 'jde', 'nID': 14455, 'nID_dict': {}}, } class Struct: def __init__(self, entries): for k, v in entries.items(): self.__setattr__(k, v) h_w = default_dataset_info[opt.task]['default_input_wh'] opt.img_size = (h_w[1], h_w[0]) print('Net input image size: {:d}×{:d}'.format(h_w[1], h_w[0])) dataset = Struct(default_dataset_info[opt.task]) opt.dataset = dataset.dataset opt = self.update_dataset_info_and_set_heads(opt, dataset) return opt
这部分是我详细的opt配置文件,刚上传了新代码,你重新下载下来跑一次,我看看logging文件,根据你之前的logging “2020-09-11 11:53:57 [INFO]: unexpected EOF, expected 161141 more bytes. The file might be corrupted. 2020-09-11 11:53:57 [INFO]: unexpected EOF, expected 161141 more bytes. The file might be corrupted.”可能是其他问题。
After I used this script at my code I got wrong labels !! Anyone know why ?
运行demo.py的时候出现了这样的错误:
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-10ubuntu2) configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 [image2 @ 0x55b3739d8700] Could find no file with path '../results/frame/%05d.jpg' and index in the range 0-4 ../results/frame/%05d.jpg: No such file or directory