This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import cv2 | |
image_files = pd.DataFrame(columns=range(784)).add_prefix('pixels_') | |
for i in range(1, 6): | |
r_image = cv2.imread(f'images/{i}.JPG') | |
numpy_image = cv2.cvtColor(r_image, cv2.COLOR_BGR2GRAY) | |
image = cv2.resize(numpy_image, (28, 28)).astype(np.float32) | |
image = image.reshape(-1) | |
image_files.loc[f'image_{i}', 'pixels_0':] = image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LightningModel(pl.LightningModule): | |
def __init__(self): | |
super().__init__() | |
def forward(self,x): | |
pass | |
def configure_optimizers(self): | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LightningDataModule(pl.LightningDataModule): | |
def __init__(self): | |
super().__init__() | |
def prepare_data(self): | |
pass | |
def setup(self,stage=None): | |
pass | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataset = LightningDataModule() | |
pl_model = LightningModel() | |
trainer = pl.Trainer(max_epochs=10) | |
trainer.fit(model=pl_model,datamodule=dataset) | |
#trainer.test(test_dataset) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# changing the names of the files in a directory | |
import os | |
import re | |
path = os.getcwd() | |
k = os.listdir(path) | |
for files in k: | |
x = re.search("\d+", files) | |
if x is None: | |
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#install boost library | |
!sudo apt-get install libboost-dev | |
#boost-root or boost-include-directory may be here /usr/include/boost | |
####follow below with example | |
"""Consider your installing mesh from https://github.com/MPI-IS/mesh, it has makefile(filename:makefile)""" | |
#--Cloning repository | |
!git clone https://github.com/MPI-IS/mesh.git | |
#--Providing permission to admin rights | |
!chmod 755 /content/mesh/Makefile | |
#--move to its project root directory by following command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#install upgraded to get full-dataset, otherwise you may get sample of it. | |
!pip install -q kaggle==1.5.6 | |
#upload kaggle.json file | |
from google.colab import files | |
files.upload() | |
#must create ~/.kaggle directory and copy kaggle.json to it. | |
!mkdir ~/.kaggle | |
!cp kaggle.json ~/.kaggle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pip install dlib | |
#download pretrained dlib file and unzip | |
#$wget http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2 | |
#$bzip2 -d /content/shape_predictor_68_face_landmarks.dat.bz2 | |
import sys | |
import numpy as np | |
import cv2 | |
#below line of code is used only in colab | |
from google.colab.patches import cv2_imshow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import webbrowser | |
import pandas as pd | |
df = pd.read_csv("sub.csv") | |
for i in df["files"].values.tolist(): | |
urls = "http://127.0.0.1:5000/question/"+str(i[:-3]) | |
#opens url in default browser, you can also use open_tab() | |
webbrowser.get().open(url=urls) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch -a #get all branch | |
git checkout master #get to the master branch | |
git checkout -b new_branch #(create and get) new branch | |
git push -u origin new_branch #push changes to new_branch to repo. for first push -u will set upstream/tracker. | |
git pull origin guru #pull the repo from guru branch | |
git add . # add present changes | |
git commit -m "fdhkfjd" # commit all the added changes. | |
git push origin guru #then push it |
OlderNewer