Commit e1e608b2 authored by Soumya Gupta's avatar Soumya Gupta

added code for gif

parent 9380cdc1
This diff is collapsed.
...@@ -10,7 +10,7 @@ for img in os.listdir(path): ...@@ -10,7 +10,7 @@ for img in os.listdir(path):
fnames.sort() fnames.sort()
with imageio.get_writer('gifs/'+newNameFolder+".gif", mode='I',duration = 0.9) as writer: with imageio.get_writer('gifs/'+newNameFolder+".gif", mode='I',duration = 0.2) as writer:
for fname in fnames: for fname in fnames:
image = imageio.imread(fname) image = imageio.imread(fname)
writer.append_data(image) writer.append_data(image)
...@@ -11,7 +11,7 @@ class Logger: ...@@ -11,7 +11,7 @@ class Logger:
_formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') _formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
def __new__(cls,*args,**kwargs): def __new__(cls,*args,**kwargs):
if not cls._instance: if not cls._instance:
identifier = 'content-reconstruction-mixed' identifier = ''
if not os.path.isdir("Logs/"): if not os.path.isdir("Logs/"):
os.mkdir("Logs/") os.mkdir("Logs/")
logHandler = logging.FileHandler("Logs/style_transfer_"+identifier+".log") logHandler = logging.FileHandler("Logs/style_transfer_"+identifier+".log")
...@@ -35,4 +35,4 @@ if __name__ == "__main__": ...@@ -35,4 +35,4 @@ if __name__ == "__main__":
ERROR = b.logger() ERROR = b.logger()
INFO.info("TEST") INFO.info("TEST")
ERROR.info("ERROR") ERROR.info("ERROR")
''' '''
\ No newline at end of file
...@@ -48,4 +48,8 @@ class Optimizer: ...@@ -48,4 +48,8 @@ class Optimizer:
#plt.plot(content_img_clone) #plt.plot(content_img_clone)
if(e%10 == 0): if(e%10 == 0):
LOGGER.info(f"Epoch = {e} Total Loss = {total_loss} content Loss = {total_cont_loss} style Loss = {total_style_loss}") LOGGER.info(f"Epoch = {e} Total Loss = {total_loss} content Loss = {total_cont_loss} style Loss = {total_style_loss}")
save_image(content_img_clone,"styled.png") identifier = ""
\ No newline at end of file name = "styled_images/"+identifier+"/styled_" + str(e) +".png"
save_image(content_img_clone,name)
save_image(content_img_clone,name)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment