Skip to content

Commit f5b0d6c

Browse files
authored
Merge pull request #1475 from ananas304/main
Projects under the 'Algorithms and Deep Learning Models' directory are missing README files are now added
2 parents cbf2c57 + cee3dea commit f5b0d6c

File tree

9 files changed

+5026
-28
lines changed

9 files changed

+5026
-28
lines changed

Algorithms and Deep Learning Models/Boxoffice/Boxoffice.ipynb

+40-16
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"metadata": {},
77
"outputs": [],
88
"source": [
9+
"# Import necessary libraries\n",
910
"import numpy as np\n",
1011
"import pandas as pd\n",
1112
"import matplotlib.pyplot as plt\n",
@@ -22,7 +23,8 @@
2223
"metadata": {},
2324
"outputs": [],
2425
"source": [
25-
"df=pd.read_csv(\"D:/Documents/Data Sets/film.csv\")"
26+
"# Load the dataset\n",
27+
"df=pd.read_csv(\"D:/Documents/Data Sets/movie_dataset.csv\")"
2628
]
2729
},
2830
{
@@ -31,6 +33,7 @@
3133
"metadata": {},
3234
"outputs": [],
3335
"source": [
36+
"# Display the first 5 rows of the dataset\n",
3437
"df.head(5)"
3538
]
3639
},
@@ -40,6 +43,7 @@
4043
"metadata": {},
4144
"outputs": [],
4245
"source": [
46+
"# Get the shape of the dataset\n",
4347
"df.shape"
4448
]
4549
},
@@ -49,6 +53,7 @@
4953
"metadata": {},
5054
"outputs": [],
5155
"source": [
56+
"# Check for missing values in the dataset\n",
5257
"df.isnull().sum()"
5358
]
5459
},
@@ -58,6 +63,7 @@
5863
"metadata": {},
5964
"outputs": [],
6065
"source": [
66+
"# Drop rows with missing values\n",
6167
"df.dropna(inplace=True)"
6268
]
6369
},
@@ -67,6 +73,7 @@
6773
"metadata": {},
6874
"outputs": [],
6975
"source": [
76+
"# Verify that there are no more missing values\n",
7077
"df.isnull().sum()"
7178
]
7279
},
@@ -76,6 +83,7 @@
7683
"metadata": {},
7784
"outputs": [],
7885
"source": [
86+
"# Display information about the dataset\n",
7987
"df.info()"
8088
]
8189
},
@@ -85,7 +93,8 @@
8593
"metadata": {},
8694
"outputs": [],
8795
"source": [
88-
"cor=df['Budget'].corr(df['Revenue'])\n",
96+
"# Calculate and display correlation between budget and revenue\n",
97+
"cor=df['budget'].corr(df['revenue'])\n",
8998
"cor"
9099
]
91100
},
@@ -95,18 +104,18 @@
95104
"metadata": {},
96105
"outputs": [],
97106
"source": [
107+
"# Encode categorical variables using Label Encoding\n",
98108
"lr=preprocessing.LabelEncoder()\n",
99-
"df['Title']=lr.fit_transform(df['Title'])\n",
100-
"df['Original Title']=lr.fit_transform(df['Original Title'])\n",
101-
"df['Original Language']=lr.fit_transform(df['Original Language'])\n",
102-
"df['Status']=lr.fit_transform(df['Status'])\n",
103-
"df['Spoken Languages']=lr.fit_transform(df['Spoken Languages'])\n",
104-
"df['Production Countries']=lr.fit_transform(df['Production Countries'])\n",
105-
"df['Production Companies']=lr.fit_transform(df['Production Companies'])\n",
106-
"df['Genres']=lr.fit_transform(df['Genres'])\n",
107-
"df['Overview']=lr.fit_transform(df['Overview'])\n",
108-
"df['Release Date']=lr.fit_transform(df['Release Date'])\n",
109-
"df['Adult']=lr.fit_transform(df['Adult'])\n"
109+
"df['title']=lr.fit_transform(df['title'])\n",
110+
"df['original_title']=lr.fit_transform(df['original_title'])\n",
111+
"df['original_language']=lr.fit_transform(df['original_language'])\n",
112+
"df['status']=lr.fit_transform(df['status'])\n",
113+
"df['spoken_languages']=lr.fit_transform(df['spoken_languages'])\n",
114+
"df['production_countries']=lr.fit_transform(df['production_countries'])\n",
115+
"df['production_companies']=lr.fit_transform(df['production_companies'])\n",
116+
"df['genres']=lr.fit_transform(df['genres'])\n",
117+
"df['overview']=lr.fit_transform(df['overview'])\n",
118+
"df['release_date']=lr.fit_transform(df['release_date'])\n"
110119
]
111120
},
112121
{
@@ -115,6 +124,7 @@
115124
"metadata": {},
116125
"outputs": [],
117126
"source": [
127+
"# Display information about the dataset after encoding\n",
118128
"df.info()"
119129
]
120130
},
@@ -124,7 +134,15 @@
124134
"metadata": {},
125135
"outputs": [],
126136
"source": [
127-
"sns.heatmap(data=df)"
137+
"# Create and display a heatmap of feature correlations\n",
138+
"correlation_matrix = df.select_dtypes(include=[np.number]).corr()\n",
139+
"plt.figure(figsize=(14, 10))\n",
140+
"sns.heatmap(correlation_matrix, annot=True, fmt='.2f', cmap='coolwarm', square=True, cbar_kws={\"shrink\": .8})\n",
141+
"plt.title('Heatmap of Feature Correlations', fontsize=20)\n",
142+
"plt.xticks(rotation=45, ha='right')\n",
143+
"plt.yticks(rotation=0)\n",
144+
"plt.tight_layout()\n",
145+
"plt.show()"
128146
]
129147
},
130148
{
@@ -133,8 +151,9 @@
133151
"metadata": {},
134152
"outputs": [],
135153
"source": [
136-
"X=df[['Budget','Popularity','Runtime']]\n",
137-
"Y=df['Revenue']\n"
154+
"# Define features and target variable for the model\n",
155+
"X=df[['budget','popularity','runtime']]\n",
156+
"Y=df['revenue']\n"
138157
]
139158
},
140159
{
@@ -143,6 +162,7 @@
143162
"metadata": {},
144163
"outputs": [],
145164
"source": [
165+
"# Split the data into training and testing sets\n",
146166
"x_train, x_test, y_train, y_test=train_test_split(X,Y, test_size=0.4)"
147167
]
148168
},
@@ -152,6 +172,7 @@
152172
"metadata": {},
153173
"outputs": [],
154174
"source": [
175+
"# Create a Linear Regression model\n",
155176
"lr=LinearRegression()"
156177
]
157178
},
@@ -161,6 +182,7 @@
161182
"metadata": {},
162183
"outputs": [],
163184
"source": [
185+
"# Fit the model to the training data\n",
164186
"lr.fit(x_train, y_train)"
165187
]
166188
},
@@ -170,6 +192,7 @@
170192
"metadata": {},
171193
"outputs": [],
172194
"source": [
195+
"# Make predictions on the testing set\n",
173196
"pred=lr.predict(x_test)"
174197
]
175198
},
@@ -179,6 +202,7 @@
179202
"metadata": {},
180203
"outputs": [],
181204
"source": [
205+
"# Evaluate the model using Mean Absolute Error\n",
182206
"print(metrics.mean_absolute_error(y_test, pred))"
183207
]
184208
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Movie Revenue Prediction
2+
This project aims to predict movie revenue based on various features such as budget, popularity, and runtime using a linear regression model.
3+
4+
## Table of Contents
5+
- [Installation](#installation)
6+
- [Dataset](#dataset)
7+
- [Usage](#usage)
8+
- [Results](#results)
9+
10+
## Installation
11+
12+
To run this project, you'll need to have Python installed along with the following libraries:
13+
```requirements.txt
14+
NumPy
15+
Pandas
16+
Matplotlib
17+
Seaborn
18+
Scikit-learn
19+
```
20+
You can install the necessary libraries using pip:
21+
22+
```bash
23+
pip install -r requirements.txt
24+
```
25+
26+
## Dataset
27+
28+
The dataset used in this project is `movie_dataset.csv`, which contains information about various movies, including their budget, revenue, popularity, runtime, and more.
29+
30+
## Usage
31+
32+
1. Clone the repository:
33+
34+
```bash
35+
git clone <your-repo-url>
36+
cd <your-repo-directory>
37+
```
38+
39+
2. Open the Jupyter Notebook:
40+
41+
```bash
42+
jupyter notebook
43+
```
44+
45+
3. Run the notebook cells sequentially to load the dataset, preprocess it, and train the linear regression model to make predictions on movie revenue.
46+
47+
## Results
48+
49+
After running the model, you will receive the Mean Absolute Error (MAE) as an evaluation metric to assess the prediction accuracy.

Algorithms and Deep Learning Models/Boxoffice/movie_dataset.csv

+4,807
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
numpy
2+
pandas
3+
matplotlib
4+
seaborn
5+
scikit-learn
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Erasing Clouds from Satellite Imagery
2+
3+
This project focuses on developing a deep learning model to remove clouds from satellite imagery. Clouds obstruct critical information in satellite images, making it difficult to analyze geographic, agricultural, and environmental features. By building a model that can effectively "erase" clouds, this project aims to provide clearer, more accurate satellite images for better analysis and decision-making.
4+
5+
## Overview
6+
7+
Satellite images are essential for various industries such as agriculture, weather forecasting, environmental monitoring, and more. However, clouds often cover parts of these images, obstructing the view of the Earth's surface. This project provides a solution by processing satellite images and removing clouds, resulting in a clearer image of the terrain below.
8+
9+
The process involves training a deep learning model on paired images — one set of images containing clouds and another set of the same location without clouds. Through multiple training iterations, the model learns how to predict and generate cloud-free images, enhancing the usability of satellite imagery.
10+
11+
## Features
12+
13+
- **Cloud Removal from Satellite Images**: The model removes cloud cover from satellite images to reveal the underlying terrain.
14+
- **Loss Visualization**: Training progress is visualized using loss plots for both the generator and discriminator components.
15+
- **Customizable Design**: The model's training parameters can be adjusted to enhance performance based on specific datasets.
16+
- **Visual Representation**: The model provides visual feedback on training progress, with clear indications of where improvements are being made.
17+
18+
## Setup
19+
20+
To run this project locally, follow these steps:
21+
22+
### Prerequisites
23+
24+
- Python 3.x
25+
- Required libraries:
26+
- `matplotlib`
27+
- `numpy`
28+
- `torch`
29+
- `PIL`
30+
31+
Install the required libraries using pip:
32+
33+
```bash
34+
pip install matplotlib numpy torch pillow
35+
```
36+
37+
### Clone the Repository
38+
39+
Clone this repository to your local machine:
40+
41+
```bash
42+
git clone <repository-url>
43+
cd <repository-directory>
44+
```
45+
46+
### Running the Project
47+
48+
1. Place the training and validation datasets in the appropriate folder (dataset structure to be defined based on your use case).
49+
3. Losses for both the generator and discriminator are plotted and saved as images after training.
50+
51+
### Visualizing Losses
52+
53+
The loss curves for the training process can be visualized using `matplotlib`:
54+
55+
```python
56+
plt.show()
57+
```
58+
59+
You can find the generated loss plots in the project directory as `Loss.jpg`.
60+
61+
## Usage
62+
63+
After training, the model can be used to process new satellite images and remove cloud cover:
64+
65+
```python
66+
python inference.py --input_image <path_to_cloudy_image>
67+
```
68+
69+
This will output a cloud-free image that can be used for further analysis.
70+
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# QR Code Scanner
2+
3+
This project is a simple QR code scanner that uses OpenCV to capture video from a webcam and detects QR codes in real-time. Once a QR code is detected, the URL or data encoded in the QR code will automatically be opened in your default web browser.
4+
5+
## Features
6+
- Real-time QR code detection using a webcam.
7+
- Automatically opens the decoded URL in the default web browser.
8+
- Exits the application after a QR code is successfully scanned and opened.
9+
10+
## Requirements
11+
12+
Before running the project, ensure you have the following installed:
13+
14+
- Python 3.x
15+
- OpenCV (`cv2`)
16+
- A webcam (integrated or external)
17+
18+
### Python Dependencies
19+
You can install the necessary dependencies using the following commands:
20+
21+
```bash
22+
pip install opencv-python
23+
```
24+
25+
## How to Run the Project
26+
1. Clone or download the project to your local machine.
27+
2. Navigate to the project directory.
28+
3. Ensure you have a working webcam connected.
29+
4. Run the Python script:
30+
```bash
31+
python qr_scan.py
32+
```
33+
The webcam will start, and as soon as a QR code is detected, its URL will be opened in your default web browser.
34+
35+
## Screenshots
36+
- Here is an example of the QR code scanner in action:
37+
1. **Camera Window Capturing QR Code:**
38+
![QR Code Scanner Capturing](https://github.com/ananas304/machine-learning-repos/blob/main/Algorithms%20and%20Deep%20Learning%20Models/QR-Scanner/QR_Scanne-qr%20code%20image%20capture.png)
39+
40+
In this screenshot, the camera window is open, and it's capturing a QR code in real-time.
41+
42+
## Notes
43+
- The application will exit automatically after a QR code is detected and the link is opened.
44+
- Press the q key to exit the scanner manually at any time.

Algorithms and Deep Learning Models/QR-Scanner/qr_scan.py

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import cv2
2-
from pyzbar.pyzbar import decode
32
import webbrowser
43

54
# Function to open web browser with the decoded QR code link
@@ -11,26 +10,25 @@ def open_link_once(url):
1110
cam.set(3, 640) # Width
1211
cam.set(4, 480) # Height
1312

13+
# Initialize the QRCode detector
14+
detector = cv2.QRCodeDetector()
15+
1416
while True:
1517
success, frame = cam.read()
1618

17-
# Decode QR codes
18-
for barcode in decode(frame):
19-
# Extract barcode data
20-
qr_data = barcode.data.decode('utf-8')
21-
print(f"QR Code data: {qr_data}")
19+
# Detect and decode the QR code
20+
data, bbox, _ = detector.detectAndDecode(frame)
21+
22+
if data:
23+
print(f"QR Code data: {data}")
2224

2325
# Open the URL in a web browser only once
24-
open_link_once(qr_data)
25-
break # Break out of the for loop after opening the link
26+
open_link_once(data)
27+
break # Break out of the loop after opening the link
2628

2729
# Display the camera frame
2830
cv2.imshow('QR Scanner', frame)
2931

30-
# Check if link has been opened and break out of the main loop
31-
if 'qr_data' in locals():
32-
break
33-
3432
# Wait for key press and break loop if 'q' is pressed
3533
if cv2.waitKey(1) & 0xFF == ord('q'):
3634
break
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
opencv-python==4.10.0.84

0 commit comments

Comments
 (0)