pytorch-yolo-v3インストールして、「python detect.py –images imgs –det det」を実行したときに発生したのが以下のエラー。

Traceback (most recent call last):
File "detect.py", line 234, in
output = torch.cat((output,prediction))
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 8 and 86 in dimension 1 at d:\build\pytorch\pytorch-1.0.1\aten\src\th\generic\thtensormoremath.cpp:1307

やはり同じ壁にぶつかってる人もいるもので、さらに解消してくれている方もいました。

これを解消するには以下のリンクで公開されている「pytorch-yolo-v3/util.py」の中身をまるっと差し替えればエラーはなくなりました。

fix concat error when no object is detected for pytorch 1.0

エラーがなくなるとこのように動きます。
C:\tool\pytorch-yolo-v3>python detect.py --images imgs --det det
Loading network.....
Network successfully loaded
C:\Anaconda3\lib\site-packages\torch\nn\modules\upsampling.py:129: UserWarning:
nn.Upsample is deprecated. Use nn.functional.interpolate instead.
warnings.warn("nn.{} is deprecated. Use nn.functional.interpolate instead.".format(self.name))
C:\tool\pytorch-yolo-v3\imgs\dog.jpg predicted in 3.255 seconds
Objects Detected: bicycle truck dog
----------------------------------------------------------
C:\tool\pytorch-yolo-v3\imgs\eagle.jpg predicted in 3.020 seconds
Objects Detected: bird
----------------------------------------------------------
C:\tool\pytorch-yolo-v3\imgs\giraffe.jpg predicted in 2.948 seconds
Objects Detected: zebra giraffe giraffe
----------------------------------------------------------
C:\tool\pytorch-yolo-v3\imgs\herd_of_horses.jpg predicted in 2.960 seconds
Objects Detected: horse horse horse horse
----------------------------------------------------------
C:\tool\pytorch-yolo-v3\imgs\img1.jpg predicted in 2.877 seconds
Objects Detected: person dog
----------------------------------------------------------
C:\tool\pytorch-yolo-v3\imgs\img2.jpg predicted in 3.109 seconds
Objects Detected: train
----------------------------------------------------------
C:\tool\pytorch-yolo-v3\imgs\img3.jpg predicted in 3.760 seconds
Objects Detected: car car car car car car car truck traffic light
----------------------------------------------------------
C:\tool\pytorch-yolo-v3\imgs\img4.jpg predicted in 3.199 seconds
Objects Detected: chair chair chair clock
----------------------------------------------------------
C:\tool\pytorch-yolo-v3\imgs\messi.jpg predicted in 3.007 seconds
Objects Detected: person person person sports ball
----------------------------------------------------------
C:\tool\pytorch-yolo-v3\imgs\person.jpg predicted in 3.250 seconds
Objects Detected: person dog horse
----------------------------------------------------------

SUMMARY
———————————————————-
Task : Time Taken (in seconds)


Reading addresses : 0.000
Loading batch : 3.449
Detection (11 images) : 35.544
Output Processing : 0.000
Drawing Boxes : 0.210
Average time_per_img : 3.568
----------------------------------------------------------