forked from vgsatorras/pytorch-caffe-darknet-convert
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.py
More file actions
43 lines (36 loc) · 1003 Bytes
/
debug.py
File metadata and controls
43 lines (36 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from __future__ import print_function
import torch.optim as optim
import os
import torch
import numpy as np
from darknet import Darknet
from caffenet import CaffeNet
from PIL import Image
from utils import image2torch, convert2cpu
from torch.autograd import Variable
cfgfile1 = 'reid.cfg'
weightfile1 = 'reid.weights'
cfgfile2 = 'reid_nbn.cfg'
weightfile2 = 'reid_nbn.weights'
cfgfile3 = 'reid_nbn.prototxt'
weightfile3 = 'reid_nbn.caffemodel'
m1 = Darknet(cfgfile1)
m1.load_weights(weightfile1)
m1.eval()
m2 = Darknet(cfgfile2)
m2.load_weights(weightfile2)
m2.eval()
m3 = CaffeNet(cfgfile3)
m3.load_weights(weightfile3)
m3.eval()
img = torch.rand(8,3,128, 64)
img = Variable(img)
output1 = m1(img).clone()
output2 = m2(img).clone()
output3 = m3(img).clone()
print('----- output1 ------------------')
print(output1.data.storage()[0:100])
print('----- output2 ------------------')
print(output2.data.storage()[0:100])
print('----- output3 ------------------')
print(output3.data.storage()[0:100])