Skip to content

Instantly share code, notes, and snippets.

View fine_tuning_end.py
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 3 14:34:44 2022
@author: aktas
"""
# import necessary layers
from tensorflow.keras.layers import Input, Conv2D , Dropout, MaxPool2D, Flatten, Dense, Activation, BatchNormalization
from tensorflow.keras import Model
View fine_tuning_begin.py
# import necessary layers
from tensorflow.keras.layers import Input, Conv2D , Dropout, MaxPool2D, Flatten, Dense
from tensorflow.keras import Model
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.regularizers import l2
import tensorflow as tf
from tensorflow.keras.callbacks import EarlyStopping, ModelCheckpoint
import os
import matplotlib.pyplot as plt
import sys
View vgg_transferlearning.py
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 29 20:56:04 2021
@author: aktas
"""
# import necessary layers
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.regularizers import l2
View vgg_from_scratch_image_classification.py
# import necessary layers
from tensorflow.keras.layers import Input, Conv2D , Dropout, MaxPool2D, Flatten, Dense
from tensorflow.keras import Model
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.regularizers import l2
import tensorflow as tf
from tensorflow.keras.callbacks import EarlyStopping, ModelCheckpoint
import os
import matplotlib.pyplot as plt
import sys
View supervised_learning.py
import numpy as np
def loss_function(prediction, ground_truth): #mean square error with batch size = 1
cost = (ground_truth-prediction)**2
return cost
def prediction(x,current_weights,current_bias):
y_predicted = np.sum((current_weights * x)) + current_bias
View harris_corner_detection.m
% reference : https://medium.com/data-breach/introduction-to-harris-corner-detector-32a88850b3f6
clear all;
close all;
clc;
% Take the grayscale of the original image
im=imread('corner2.png');
figure
View triangulation.m
%% Obtain 2 cameras seeing the same scene
clear all;
close all;
clc;
PTS= load('pts3D.txt');
count_3d_points = length(PTS);
tmp = ones(count_3d_points,1);
PTS_homogenous = [PTS, tmp];
View epipolar_geometry.m
clear all;
close all;
clc;
PTS1 = load('pts2D_1.txt'); % 300 x 2 matrix
PTS2 = load('pts2D_2.txt'); % 300 x 2 matrix
tmp = ones(length(PTS1),1);
Homogenous_PTS1 = [PTS1, tmp];
View zhang.m
clear all;
close all;
clc;
%We have simulated a regular checkerboard pattern, comprising 10x10 points, and a camera observing it.
%The checkerboard is moved around the camera and 10 images of it are acquired in the process.
%PTS_world = load('ptsXY.txt'); % Cartesian coordinates of the checkerboard points,
%Pixel coordinates of the 2D points in the 10 images, given in pts2D_i.txt, i = 1, 2, ..., 10.
View DLT.m
% Apply DLT using the following functions
% World_PTS : 3D world points, GT_PTS: 2D Projected image points of these 3D world points,
% Calibration_Points_Count : the quantity of points we use for realizing calibration
function DLT(World_PTS, GT_PTS, Calibration_Points_Count)
A = Create_Matrix_A(Calibration_Points_Count, World_PTS, GT_PTS)
P = Obtain_Projection_Matrix(A)
[K,R,T] = QR_Decomposition(P)
[Projected_X, Projected_Y] = Projection(P, World_PTS, GT_PTS);
end