akankshakshurai/cuda-error-resolution-analysis huggingface dataset:
Passing a model input to another model to generate Sketch

username: KURUVILLA_ABRAHAM
cooked: <p>Hi Team,</p>
<p>I am using and Generator output(input contains both Edge and Original Image) and feeding to another network to produce sketch of the image to calculate the loss between the output and Sketch but unfortunately i am not able to generate required sketch.</p>
<p>##<span class="hashtag">#Generator</span> model##<br>
recon = model(real,edge,Target_color.float(),noise)<br>
##<span class="hashtag">#Sketch</span> model<br>
fake_image = cycle_model(recon)</p>
<p>and then calulate mse loss between both<br>
loss = criterion(fake_image,edge)</p>
<p>Here Edge is list of batch of 8 from dataloader<br>
fake_image also is batch of 8 from the model</p>
<p>Could you please guid me the way i am passing input to sketch model is fine or not<br>
If i display each and every image after this line</p>
<p>fake_image = cycle_model(recon)<br>
fake_image_ex = fake_image.detach().cpu().data<br>
for img in fake_image_ex:<br>
plt.imshow(np.transpose(img,(1,2,0)))<br>
plt.show()<br>
They are learnt after some epochs very well and displayed as a sketch</p>
<p>But when i am using the whole model for Referencing and generating Sketch i could find images are black in color .</p>
<p>for batch_idx, img in enumerate(zip(loaders[‘test_rgbimage_dataloader’],loaders[‘test_grayscale_dataloader’])):<br>
with torch.no_grad():<br>
real,edge = img[0], img[1]<br>
real = real[0].to(device)<br>
edge = edge[0].to(device)<br>
recon = trained_model(real,edge,Target_color.float(),noise)<br>
images = recon.detach().cpu().data<br>
for img in images:<br>
imshow(img)</p>
<p>What could be the problem here</p>