Krudev commited on
Commit
92c9200
·
verified ·
1 Parent(s): 859d8bd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +112 -2
README.md CHANGED
@@ -26,6 +26,114 @@ Most view-prediction models fail because they are blind to channel size—a 100k
26
  ##### (Coming Soon)
27
 
28
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  ### AI & Technical Specifics
31
 
@@ -47,9 +155,11 @@ This model relies on historical channel data to establish its baseline. If a cha
47
 
48
  **Datasets Used**
49
 
50
- The model is trained on a highly curated dataset of **16.28k samples**, finalized after cleaning out approximately 1,900 missing or corrupted images.
 
 
51
 
52
- To hint to the model that the YouTube algorithm is naturally biased toward standard performance over viral hits, the dataset intentionally maintains a **1:3 ratio (outlier : normal)**. To prevent the model from simply predicting "normal" every time due to this skew, higher class weights were applied to the positive (outlier) samples during training to balance the learning process. Additionally, to prevent any single creator from skewing the model's understanding of an "outlier," data scraping was strictly limited to a maximum of 5 samples per channel.
53
 
54
  ---
55
 
 
26
  ##### (Coming Soon)
27
 
28
  ---
29
+ ### Getting It Running!
30
+ **Prerequisites**
31
+
32
+ Before installing and running the ONNX models, ensure your environment meets the following requirements:
33
+
34
+ * Python 3.x
35
+ * `onnxruntime`
36
+ * `pillow`
37
+ * `numpy`
38
+ * `transformers`
39
+ * `huggingface_hub`
40
+
41
+ **Installation Guide**
42
+
43
+ You can install the required dependencies using pip:
44
+
45
+ ```bash
46
+ pip install onnxruntime pillow numpy transformers huggingface_hub
47
+ ```
48
+
49
+ **Usage & API Examples**
50
+
51
+ To begin, download the ONNX model files programmatically using the Hugging Face Hub library.
52
+
53
+ *Note: kindly stay away from cloning git it'll download hash instead of actual model weights.*
54
+
55
+ ```python
56
+ from huggingface_hub import snapshot_download
57
+
58
+ REPO = "Krudev/z03"
59
+ snapshot_download(repo_id=REPO, local_dir="./z03") #i hate hidden files
60
+ ```
61
+
62
+ Once downloaded, you can import the utility functions to run predictions within your Python environment.
63
+
64
+ **Thumbnail Model Execution**
65
+
66
+ ```python
67
+ from inference.utils import predict_thumbnail_onnx
68
+
69
+ thumbnail = "./TBxS0XhdfmU-HD.jpg"
70
+ model_path = "./z03/onnx/thumbnail_predictor.onnx"
71
+ prob, pred = predict_thumbnail_onnx(model_path, thumbnail, image_size=299)
72
+ print(prob, pred)
73
+ ```
74
+
75
+ **Title Model Execution**
76
+
77
+ ```python
78
+ from inference.utils import predict_title_onnx
79
+
80
+ title = "hello"
81
+ model_path = "./z03/onnx/title_predictor.onnx"
82
+ prob, pred = predict_title_onnx(model_path, title)
83
+ print(prob, pred)
84
+ ```
85
+
86
+ ---
87
+
88
+ **Command Line Interface (CLI)**
89
+
90
+ If you want easiest inference!
91
+ this is for you ;) (CLI!!)
92
+
93
+ For streamlined operations, you can pass arguments directly via the terminal using `easy_inference.py`.
94
+
95
+ **Thumbnail Only**
96
+
97
+ ```bash
98
+ python ./z03/inference/easy_inference.py --image_path ./TBxS0XhdfmU-HD.jpg
99
+ ```
100
+ ```text
101
+ --- Thumbnail Inference ---
102
+ File: ./TBxS0XhdfmU-HD.jpg
103
+ Probability: 0.8742
104
+ Prediction: 1
105
+ ```
106
+
107
+ **Title Only**
108
+
109
+ ```bash
110
+ python ./z03/inference/easy_inference.py --title "SHOCKING Secret About My New Setup!"
111
+ ```
112
+ ```text
113
+ --- Title Inference ---
114
+ Text: 'SHOCKING Secret About My New Setup!'
115
+ Probability: 0.9315
116
+ Prediction: 1
117
+ ```
118
+
119
+ **Both Simultaneously**
120
+
121
+ ```bash
122
+ python ./z03/inference/easy_inference.py --image_path ./TBxS0XhdfmU-HD.jpg --title "SHOCKING Secret About My New Setup!"
123
+ ```
124
+ ```text
125
+ --- Thumbnail Inference ---
126
+ File: ./TBxS0XhdfmU-HD.jpg
127
+ Probability: 0.8742
128
+ Prediction: 1
129
+
130
+ --- Title Inference ---
131
+ Text: 'SHOCKING Secret About My New Setup!'
132
+ Probability: 0.9315
133
+ Prediction: 1
134
+ ```
135
+
136
+ ---
137
 
138
  ### AI & Technical Specifics
139
 
 
155
 
156
  **Datasets Used**
157
 
158
+ The model is trained on a highly curated dataset of **16.28k samples** collected using official YouTube Data Api V3 and rigorously filtered from 250k unique samples, finalized after cleaning out approximately 1,900 missing or corrupted images.
159
+
160
+ To hint to the model that the YouTube algorithm is naturally biased toward standard performance over viral hits, the dataset intentionally maintains a **1:3 ratio (outlier : normal)**. To prevent the model from simply predicting "normal" every time due to this skew, higher class weights were applied to the positive (outlier) samples during training to balance the learning process. Additionally, to prevent any single creator from skewing the model's understanding of an "outlier," data scraping was strictly limited to a maximum of 5 samples per channel.
161
 
162
+ To comply with Apis policy the dataset will not be published and kept more than 30 days.
163
 
164
  ---
165