|
|
|
@ -1,4 +1,6 @@ |
|
|
|
|
# Script is based on https://github.com/richzhang/colorization/colorize.py |
|
|
|
|
# Script is based on https://github.com/richzhang/colorization/blob/master/colorize.py |
|
|
|
|
# To download the caffemodel and the prototxt, see: https://github.com/richzhang/colorization/tree/master/models |
|
|
|
|
# To download pts_in_hull.npy, see: https://github.com/richzhang/colorization/blob/master/resources/pts_in_hull.npy |
|
|
|
|
import numpy as np |
|
|
|
|
import argparse |
|
|
|
|
import cv2 as cv |
|
|
|
@ -27,8 +29,8 @@ if __name__ == '__main__': |
|
|
|
|
|
|
|
|
|
# populate cluster centers as 1x1 convolution kernel |
|
|
|
|
pts_in_hull = pts_in_hull.transpose().reshape(2, 313, 1, 1) |
|
|
|
|
net.getLayer(long(net.getLayerId('class8_ab'))).blobs = [pts_in_hull.astype(np.float32)] |
|
|
|
|
net.getLayer(long(net.getLayerId('conv8_313_rh'))).blobs = [np.full([1, 313], 2.606, np.float32)] |
|
|
|
|
net.getLayer(net.getLayerId('class8_ab')).blobs = [pts_in_hull.astype(np.float32)] |
|
|
|
|
net.getLayer(net.getLayerId('conv8_313_rh')).blobs = [np.full([1, 313], 2.606, np.float32)] |
|
|
|
|
|
|
|
|
|
if args.input: |
|
|
|
|
cap = cv.VideoCapture(args.input) |
|
|
|
|