vishal-adithya commited on
Commit
904c408
·
verified ·
1 Parent(s): e28febc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -19
README.md CHANGED
@@ -19,23 +19,28 @@ tags:
19
  # Depth Estimation Using ResNet50 and XGBoost
20
 
21
  ## Overview
22
- This project demonstrates a depth estimation model that predicts the average depth of images using features extracted from a pre-trained ResNet50 model and an XGBoost regressor. The model was trained using the **NYUv2 dataset** hosted on Hugging Face ([0jl/NYUv2](https://huggingface.co/datasets/0jl/NYUv2)). The trained model is saved as `model.pkl` using Python's `pickle` library for easy deployment and reuse.
 
 
 
 
 
 
 
23
  ### Loading the Model
24
  The model is saved as `model.pkl` using `pickle`. You can load and use it as follows:
25
 
26
  ```python
27
- import pickle
28
-
29
- # Load the trained model
30
  with open("model.pkl", "rb") as f:
31
  model = pickle.load(f)
32
 
33
- # Example usage
34
- features = extract_features("path/to/image.jpg") # Use the same feature extraction pipeline
35
  predicted_depth = model.predict([features])
36
- print("Predicted Depth:", predicted_depth[0])
37
  ```
38
- ## Features
 
 
39
  - **Model Architecture**:
40
  - Feature extraction: ResNet50 (pre-trained on ImageNet, with the top layers removed and global average pooling).
41
  - Regression: XGBoost, optimized for structured data prediction.
@@ -47,7 +52,7 @@ print("Predicted Depth:", predicted_depth[0])
47
  - Format: The dataset includes RGB images and corresponding depth maps.
48
  - Preprocessing:
49
  - Images were resized to 224x224 pixels to match the input requirements of ResNet50.
50
- - Depth maps were converted into single average depth values for each image by taking the mean of the depth map.
51
 
52
  ## Model Training
53
  1. **Feature Extraction**:
@@ -58,12 +63,12 @@ print("Predicted Depth:", predicted_depth[0])
58
  - Hyperparameters were tuned using cross-validation techniques for optimal performance.
59
 
60
  ## Results
61
- - **R² Score**: 0.841.
62
  - Performance is reasonable for a first few implementation and can be further improved with additional tuning or by improving feature extraction methods.
63
 
64
  ## How to Use
65
  ### Requirements
66
- 1. Python 3.8+
67
  2. Required libraries:
68
  - `numpy`
69
  - `pickle`
@@ -72,7 +77,6 @@ print("Predicted Depth:", predicted_depth[0])
72
  - `tensorflow`
73
  - 'scikit-learn'
74
 
75
-
76
  Install the dependencies using pip:
77
  ```bash
78
  pip install numpy tensorflow xgboost pickle-mixin datasets scikit-learn
@@ -80,7 +84,7 @@ pip install numpy tensorflow xgboost pickle-mixin datasets scikit-learn
80
 
81
  ### Training Pipeline
82
  If you want to retrain the model, follow these steps:
83
- NOTE: This pipeline has just the base fundamental code more additional parameter tunings and preprocessing steps were being conducted during the training of the original model
84
  1. Download the **NYUv2 dataset** from Hugging Face:
85
  ```python
86
  from datasets import load_dataset
@@ -106,12 +110,7 @@ NOTE: This pipeline has just the base fundamental code more additional parameter
106
  with open("model.pkl", "wb") as f:
107
  pickle.dump(regressor, f)
108
  ```
109
-
110
- ## License
111
- This project is licensed under the Apache License 2.0.
112
-
113
- ## Author
114
- **Vishal Adithya.A**
115
 
116
  ## Acknowledgments
117
  - Hugging Face for hosting the NYUv2 dataset.
 
19
  # Depth Estimation Using ResNet50 and XGBoost
20
 
21
  ## Overview
22
+ This project demonstrates a depth estimation XgBoost Regressor model that predicts the average depth of images provided using features extracted from a pre-trained ResNet50 model.The model was trained upon the **NYUv2 dataset** ([0jl/NYUv2](https://huggingface.co/datasets/0jl/NYUv2)). The trained model is saved as using Python's `pickle` library for easy deployment and reuse.
23
+
24
+ ## License
25
+ This project is licensed under the Apache License 2.0.
26
+
27
+ ## Author
28
+ **Vishal Adithya.A**
29
+
30
  ### Loading the Model
31
  The model is saved as `model.pkl` using `pickle`. You can load and use it as follows:
32
 
33
  ```python
 
 
 
34
  with open("model.pkl", "rb") as f:
35
  model = pickle.load(f)
36
 
37
+ features = extract_features("path/to/image.jpg")
 
38
  predicted_depth = model.predict([features])
39
+ print(predicted_depth[0])
40
  ```
41
+ extract_features() is a predefined function in the original code which uses ResNet50 to extract features out of the image
42
+
43
+ ## Key Features
44
  - **Model Architecture**:
45
  - Feature extraction: ResNet50 (pre-trained on ImageNet, with the top layers removed and global average pooling).
46
  - Regression: XGBoost, optimized for structured data prediction.
 
52
  - Format: The dataset includes RGB images and corresponding depth maps.
53
  - Preprocessing:
54
  - Images were resized to 224x224 pixels to match the input requirements of ResNet50.
55
+ - Depth maps were converted into single average depth values.
56
 
57
  ## Model Training
58
  1. **Feature Extraction**:
 
63
  - Hyperparameters were tuned using cross-validation techniques for optimal performance.
64
 
65
  ## Results
66
+ - **R² Score**: 0.841
67
  - Performance is reasonable for a first few implementation and can be further improved with additional tuning or by improving feature extraction methods.
68
 
69
  ## How to Use
70
  ### Requirements
71
+ 1. Python 3.10+
72
  2. Required libraries:
73
  - `numpy`
74
  - `pickle`
 
77
  - `tensorflow`
78
  - 'scikit-learn'
79
 
 
80
  Install the dependencies using pip:
81
  ```bash
82
  pip install numpy tensorflow xgboost pickle-mixin datasets scikit-learn
 
84
 
85
  ### Training Pipeline
86
  If you want to retrain the model, follow these steps:
87
+
88
  1. Download the **NYUv2 dataset** from Hugging Face:
89
  ```python
90
  from datasets import load_dataset
 
110
  with open("model.pkl", "wb") as f:
111
  pickle.dump(regressor, f)
112
  ```
113
+ NOTE: This pipeline has just the base fundamental code more additional parameter tunings and preprocessing steps were being conducted during the training of the original model
 
 
 
 
 
114
 
115
  ## Acknowledgments
116
  - Hugging Face for hosting the NYUv2 dataset.