1
$\begingroup$
r = s \[Function] i \[Function] ImageResize[i, s];
ab = ColorSeparate[#, "LAB"][[2 ;;]] &;
out = ImageData /@ ab[# // r@{56, 56}] &;
imgs = Import /@ FileNames["*.jpg", dir, 2]; (*dir = somewhere on my disk*)
data = Table[i -> out@i, {i, imgs}];

raw = NetModel[
  "Colorful Image Colorization Trained on ImageNet Competition Data",
  "UninitializedEvaluationNet"
];
nex = NetTrain[raw, data, TargetDevice -> "GPU"]

performs training but produces results that fail to colorize no matter what. (All experiences described are same with/without TargetDevice -> "GPU".)

The LAB A and B channels the above produces after training are always empty.

  1. Using NetInitialize[raw] before training does not help.
  2. NetModel["Colorful Image Colorization Trained on ImageNet Competition \ Data", "Properties"] has no
    1. TrainingNetwork
    2. UninitializedTrainingNetwork

raw = NetModel[
  "Colorful Image Colorization Trained on ImageNet Competition Data",
  "EvaluationNet"
];
nex = NetTrain[raw, data, TargetDevice -> "GPU"]

produces different results but it is not clear to me what this does.

  1. Does the above continue training an already-trained EvaluationNetwork?
  2. Is there a way to discard the memory of a neural network to have it start training from scratch?
$\endgroup$
  • 1
    $\begingroup$ You can get "UninitializedEvaluationNet" from NetModel for that network the same way you're currently getting "EvaluationNet. Further, NetInitialize[net, All] will reset all trainable weights in the net including those already trained, while NetInitialize[net] will initialize only weights that have not yet been trained. $\endgroup$ – Carl Lange Dec 9 '19 at 14:09
  • 1
    $\begingroup$ Getting "UninitializedEvaluationNet" produces empty zero-valued ImageData as outputs for the LAB A and B channels as mentioned in my question. I will try NetInitialize[net, All] now and let you know. $\endgroup$ – Cetin Sert Dec 9 '19 at 14:21
  • $\begingroup$ My apologies, I didn't see that in your question! $\endgroup$ – Carl Lange Dec 9 '19 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.