Different type of difficulties and problem faced by programmer, super user and AI Creator on digital world. Some of technical solutions that faced and overcome or solve by me with this tips and tricks.
Monday, August 19, 2024
Monday, August 21, 2023
R Language Fetching Data From Excel Sheet
Install xlsx Package :-
install.packages("xlsx") Verify and Load the "xlsx" Package:- # Verify the package is installed. any(grepl("xlsx",installed.packages())) # Load the library into R workspace. library("xlsx") Reading the Excel File:- # Read the first worksheet in the file input.xlsx. data <- read.xlsx("student_list.xlsx", sheetIndex = 1) print(data) #Data Query in Excel Sheet Column Header :- retval <- subset(data, Blood.Group == "O+") print(retval)
Reading a CSV File :-data <- read.csv("Mutual Fund List.csv")print(data) print(is.data.frame(data)) print(ncol(data)) print(nrow(data)) # Get the max salary from data frame. sal <- max(data$salary) print(sal) # Get the max salary from data frame. sal <- max(data$salary) # Get the person detail having max salary. retval <- subset(data, salary == max(salary)) print(retval) #Get all the people working in IT department retval <- subset( data, dept == "IT") print(retval) #Get the persons in IT department whose salary is greater than 600 info <- subset(data, salary > 600 & dept == "IT") print(info) #Get the people who joined on or after 2014 retval <- subset(data, as.Date(start_date) > as.Date("2014-01-01")) print(retval) # Write filtered data into a new file. write.csv(retval,"output.csv") newdata <- read.csv("output.csv") print(newdata)
Tuesday, August 15, 2023
Super Image Resolution By Artificial Intelligence Deep Learning
Artificial Intelligence Super Image Resolution
Upscale From 565 x 559 To 2260 x 2236
# initialize super resolution object
# read the model
# set the model and scale
# if you have cuda support
# load the image
# upsample the image
# save the upscaled image
# traditional method - bicubic
# save the image
Super Resolution Image By Deep Learning Library LapSRN_x8 :-
# initialize super resolution object
# read the model
# set the model and scale
# if you have cuda support
# load the image
# upsample the image
# save the upscaled image
# traditional method - bicubic
# save the image
Super Resolution Image By Deep Learning Library FSRCNN_x3 :-
Super Resolution Image By Deep Learning Library FSRCNN_x4 :-
Monday, August 14, 2023
MySQL Database and Table Query
MySQL Database and Table Query For Getting Desired Result.
Sunday, August 13, 2023
R Language Fetching Data From MySql Table
R Language How to Get Data From MySql Table :
install.packages("RMySQL")
library("RMySQL")Step : 2Create a connection Object to MySQL database.
We will connect to the sample database named
"DB_school" that comes with MySql installation.mysqlconnection = dbConnect(MySQL(),user='root',password='',dbname='DB_school',host='localhost')Step : 3View List the tables available in this database.dbListTables(mysqlconnection)Step : 4Query the "register" tables to get all the rows.result = dbSendQuery(mysqlconnection, "select * from registerdb")Step : 5Store the result in a R data frame object. n = 5 is used to
fetch first 5 rows.data.frame = fetch(result, n = 5) print(data.frame)Step : 6We can pass any valid select query to get the result.result = dbSendQuery(mysqlconnection, "select * from registerdb where YYYY = '2010'")Step : 7Fetch all the records(with n = -1) and store it as a data frame.data.frame = fetch(result, n = -1) print(data.frame)
Thursday, August 10, 2023
Face Recognition Smart Attendance System
FACE ATTENDANCE SYSTEM DEMOSTRATION :
STEP : 1
CHECKING WEBCAM.
STEP : 2
CAPTURE FACE BY WEBCAM & STORED IN A FOLDER.
STEP : 3
TRAINED THE FACE IMAGES BY AI.
STEP : 4
NOW RECOGNISED FACE BY WEBCAM WITH AI.
FACE ATTENDENCE SYSTEM MAKING LOGIC
FACE RECOGNITION SYSTEM THAT MACHING FACE FROM STORED MULTIPLE PERSON IMAGE WITH MAXIMUM ACCURACY
Python Code Is Now Here : (Write and Test It Proper Indentation.)
import cv2
import face_recognition
import os
import numpy as np
# Load the images from the folder
folder_path = '../userPhoto'
image_files = os.listdir(folder_path)
# Initialize arrays to store known face encodings and names
known_encodings = []
known_names = []
known_images = []
# Load the known face images and compute their encodings
for image_file in image_files:
image_path = os.path.join(folder_path, image_file)
image = face_recognition.load_image_file(image_path)
face_locations = face_recognition.face_locations(image)
if len(face_locations) > 0:
encoding = face_recognition.face_encodings(image, face_locations)[0]
known_encodings.append(encoding)
known_names.append(os.path.splitext(image_file)[0])
known_images.append(cv2.resize(image, (100, 100))) # Resize image for thumbnail display
# Initialize the webcam
video_capture = cv2.VideoCapture(0)
while True:
# Capture frame-by-frame from the webcam
ret, frame = video_capture.read()
# Convert the frame to RGB for face recognition
rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
# Detect faces in the frame
face_locations = face_recognition.face_locations(rgb_frame)
face_encodings = face_recognition.face_encodings(rgb_frame, face_locations)
# Iterate over detected faces
for (top, right, bottom, left), face_encoding in zip(face_locations, face_encodings):
# Compare the face with known encodings
distances = face_recognition.face_distance(known_encodings, face_encoding)
min_distance_index = np.argmin(distances)
min_distance = distances[min_distance_index]
if min_distance <= 0.45: # Adjust the threshold as needed
name = known_names[min_distance_index]
accuracy = (1 - min_distance) * 100 # Calculate accuracy percentage
thumbnail = known_images[min_distance_index]
# Draw a rectangle around the face
cv2.rectangle(frame, (left, top), (right, bottom), (0, 255, 0), 2)
# Display the name and accuracy below the face rectangle
text = f"{name}: {accuracy:.2f}%"
cv2.putText(frame, text, (left, bottom + 20), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 255, 0), 1)
# Display the thumbnail image in the top right corner
frame[10:110, frame.shape[1] - 110:frame.shape[1] - 10] = thumbnail
else:
name = "Unknown"
# Draw a rectangle around the face
cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2)
# Display the name below the face rectangle
cv2.putText(frame, name, (left, bottom + 20), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 0, 255), 1)
# Display the resulting frame
cv2.imshow('Face Recognition', frame)
# Quit the program if 'q' is pressed
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Release the webcam and close windows
video_capture.release()
cv2.destroyAllWindows()
Python Blitz Bits: Zippy Snippets & Spark Projects for Instant Coding Wins
Python Blitz Bits: Zippy Snippets & Spark Projects for Instant Coding Wins
-
R Language Query Data on Excel Sheet Column Header :- Install xlsx Package :- install.packages("xlsx") Verify and Load the ...
-
FACE RECOGNITION SYSTEM THAT MACHING FACE FROM STORED MULTIPLE PERSON IMAGE WITH MAXIMUM ACCURACY Python Code Is Now Here : ( Write and Te...
-
Modern Mining Business Global Companies like Newmont Corporation (USA), Barrick Gold Corporation (Canada), AngloGold Ashanti (South Afri...







