<jupyter_start><jupyter_text><jupyter_code>from google.colab import drive
drive.mount('/content/gdrive',force_remount=True)
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data as data
from torch.utils.data import Dataset, DataLoader


import torchvision.transforms as transforms #common image transformations
import torchvision.datasets as datasets

import matplotlib.pyplot as plt
import numpy as np
import random

import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from torch.autograd import Variable


#imports for confusion matrix
from sklearn.metrics import confusion_matrix
from sklearn.metrics import plot_confusion_matrix
import seaborn as sn
import pandas as pd

from copy import deepcopy
from collections import deque
from PIL import Image
import math

import os
import shutil
torch.cuda.empty_cache()
!pip install torch==1.9.0 
!pip install torchvision --upgrade
import torch
print(torch.__version__)
def get_device():
    if torch.cuda.is_available():
        device = 'cuda:0'
    else:
        device = 'cpu'
    return device
#packages to print our process memory usage
!pip install gputil
!pip install psutil
!pip install humanize
!pip install tensorboardX
print(os.getcwd())
os.chdir('/content/gdrive/MyDrive/segmentation')
print(os.getcwd())
!python ../segmentation/train_fcn.py \
--outdir results/cityscapes/cityscapes_fcn8s \
--model fcn8s \
--num_cls 19 \
--lr 1e-3 \
--batch_size 1 \
--p_synthetic 0.8 \
--momentum 0.9 \
--crop_size 512 \
--iterations 2 \
--downscale 1 \
--datadir /content/gdrive/MyDrive \
--dataset cityscapes 

#was iterations 100000
#downscale 1 added
#batch size was 6
#crop size: size of patches, was 600 for the initial (original) dimension of the image (1024)
#now i downscaled the image from 1024 to 512
#so the crop_size should be less than 512 (600 was initially), i put it 500

 
!python ../segmentation/eval_fcn.py \
--path '../segmentation/results/cityscapes/cityscapes_fcn8s-iter0.pth' \
--dataset cityscapes \
--datadir /content/gdrive/MyDrive \
--model fcn8s \
--num_cls 19

np.random.uniform(low = 0.0, high = 1.0, size = None)  
#prepei na valw tin synthetic mesa sto while loop
#kai sugkekrimena mesa sto if-else statement
#kai efoson <=p (ara paragw synthetic) prepei kapws na tin valw ston dataloader
#gia na mporw na prw to im1 kai to label 
#?<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0876689881196231, 'fraction_numerical': 0.02498975829578042, 'mean_word_length': 4.217948717948718, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '338899', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 862, 'n_tokens_neox': 791, 'n_words': 280, 'path': 'Segmentation_training_list.ipynb', 'repo_name': 'Kyveli-tsioli/cycada_release', 'size': '2441'}