Voglio implementare VGG Face Descriptor in python. Ma continuo a ricevere un errore:VGG Face Descriptor in python con caffe
TypeError: can only concatenate list (not "numpy.ndarray") to list
Il mio codice:
import numpy as np
import cv2
import caffe
img = cv2.imread("ak.png")
img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
net = caffe.Net("VGG_FACE_deploy.prototxt","VGG_FACE.caffemodel", caffe.TEST)
print net.forward(img)
mi potete aiutare?
UPDATE 1
codice Questo lavoro è esempio in MATLAB
% Copyright (c) 2015, Omkar M. Parkhi
% All rights reserved.
img = imread('ak.png');
img = single(img);
Img = [129.1863,104.7624,93.5940] ;
img = cat(3,img(:,:,1)-averageImage(1),...
img(:,:,2)-averageImage(2),...
img(:,:,3)-averageImage(3));
img = img(:, :, [3, 2, 1]); % convert from RGB to BGR
img = permute(img, [2, 1, 3]); % permute width and height
model = 'VGG_FACE_16_deploy.prototxt';
weights = 'VGG_FACE.caffemodel';
caffe.set_mode_cpu();
net = caffe.Net(model, weights, 'test'); % create net and load weights
res = net.forward({img});
prob = res{1};
caffe_ft = net.blobs('fc7').get_data();
perché non stai usando 'caffe.io.load_image'? – Shai
Se provo 'caffe.io.load_image' ho lo stesso errore' TypeError: posso solo concatenare lista (non "numpy.ndarray") per elencare'. Se provo a passare un singolo elenco di elementi al metodo ottengo errore 'TypeError: tipo non disattivabile: 'numpy.ndarray'' – Iwn
prova' net.forward_all' invece di 'forward'. – Shai