Skip to content

Commit

Permalink
Final Run
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitkuk committed Jun 12, 2021
1 parent a5fc271 commit 5141f69
Show file tree
Hide file tree
Showing 4 changed files with 13,554 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,5 @@ run.sh
List.md
# exception to the rule

!data/.gitkeep
!data/.gitkeep
weights/Cartoonify_Generator.pt
42 changes: 42 additions & 0 deletions inference.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

import imp
from statistics import mode
import torch
from torchvision import transforms
import argparse
from PIL import Image



parser = argparse.ArgumentParser()


parser.add_argument('--img', metavar='img', type=str ,
help = "Image to Cartoonize")

args = parser.parse_args()


DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
IMG_DIM = 512
lr = 2e-4
MAPS_GEN = 64
MAPS_DISC = 64
IMG_CHANNELS = 3
L1_LAMBDA = 100


Trasforms = transforms.Compose([
transforms.Resize(IMG_DIM),
transforms.CenterCrop(IMG_DIM),
transforms.ToTensor(),
transforms.Normalize(
(0.5, 0.5, 0.5),
(0.5, 0.5, 0.5))
])

model = torch.load('weights/Cartoonify_Generator.pt')

model.to(DEVICE)

img = Image.open(args.img)
12 changes: 1 addition & 11 deletions research/Data Exploration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{
"cell_type": "code",
"execution_count": 29,
"id": "forbidden-consent",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -24,7 +23,6 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "forward-elite",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -38,7 +36,6 @@
{
"cell_type": "code",
"execution_count": 7,
"id": "sharing-focus",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -85,7 +82,6 @@
{
"cell_type": "code",
"execution_count": 8,
"id": "behavioral-lambda",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -124,7 +120,6 @@
{
"cell_type": "code",
"execution_count": 17,
"id": "directed-cambridge",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -141,7 +136,6 @@
{
"cell_type": "code",
"execution_count": 20,
"id": "liquid-option",
"metadata": {},
"outputs": [
{
Expand All @@ -164,7 +158,6 @@
{
"cell_type": "code",
"execution_count": 32,
"id": "experienced-construction",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -174,7 +167,6 @@
{
"cell_type": "code",
"execution_count": 50,
"id": "developmental-explanation",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -234,7 +226,6 @@
{
"cell_type": "code",
"execution_count": 41,
"id": "broken-diary",
"metadata": {},
"outputs": [
{
Expand All @@ -254,7 +245,6 @@
{
"cell_type": "code",
"execution_count": null,
"id": "south-pantyhose",
"metadata": {},
"outputs": [],
"source": []
Expand All @@ -281,4 +271,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
Loading

0 comments on commit 5141f69

Please sign in to comment.