Upload 5 files
Browse files- RUN.txt +3 -0
- detector_model.pth +3 -0
- final_submission_report (1).json +302 -0
- predict.py +175 -0
- requirements.txt +5 -0
RUN.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
To Run the code:
|
| 2 |
+
pip install -r requirements.txt
|
| 3 |
+
python predict.py --input_dir ./test_images --output_file submission.json --model_path detector_model.pth
|
detector_model.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cb761f34e5b7074b40b9cedc5c2f5d3856b25f57c57f3f546d9f1cb6f5d1bfd7
|
| 3 |
+
size 44794379
|
final_submission_report (1).json
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"image_name": "splice_real_place_0.jpg",
|
| 4 |
+
"authenticity_score": 0.5901,
|
| 5 |
+
"manipulation_type": "fake_ai",
|
| 6 |
+
"vlm_reasoning": "Manipulation detected: the chair lacks a grounded contact shadow; spatial disconnection observed (floating chair). The integration of the chair into the scene is physically inconsistent."
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
"image_name": "splice_real_place_1.jpg",
|
| 10 |
+
"authenticity_score": 0.5904,
|
| 11 |
+
"manipulation_type": "fake_ai",
|
| 12 |
+
"vlm_reasoning": "Manipulation detected: illumination on the table contradicts the room's light source. The integration of the table into the scene is physically inconsistent."
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"image_name": "splice_real_place_2.jpg",
|
| 16 |
+
"authenticity_score": 0.5858,
|
| 17 |
+
"manipulation_type": "fake_splice",
|
| 18 |
+
"vlm_reasoning": "Manipulation detected: the table lacks a grounded contact shadow; illumination on the table contradicts the room's light source. The integration of the table into the scene is physically inconsistent."
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"image_name": "splice_real_place_3.jpg",
|
| 22 |
+
"authenticity_score": 0.5767,
|
| 23 |
+
"manipulation_type": "fake_ai",
|
| 24 |
+
"vlm_reasoning": "Manipulation detected: the bench lacks a grounded contact shadow; illumination on the bench contradicts the room's light source. The integration of the bench into the scene is physically inconsistent."
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"image_name": "splice_real_place_4.jpg",
|
| 28 |
+
"authenticity_score": 0.5831,
|
| 29 |
+
"manipulation_type": "fake_ai",
|
| 30 |
+
"vlm_reasoning": "Manipulation detected: the bench lacks a grounded contact shadow; illumination on the bench contradicts the room's light source. The integration of the bench into the scene is physically inconsistent."
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"image_name": "splice_real_place_5.jpg",
|
| 34 |
+
"authenticity_score": 0.9538,
|
| 35 |
+
"manipulation_type": "real",
|
| 36 |
+
"vlm_reasoning": "Authentic scene. The outside displays consistent global illumination and natural perspective geometry."
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"image_name": "splice_real_place_6.jpg",
|
| 40 |
+
"authenticity_score": 0.5981,
|
| 41 |
+
"manipulation_type": "fake_ai",
|
| 42 |
+
"vlm_reasoning": "Manipulation detected: the none lacks a grounded contact shadow; illumination on the none contradicts the room's light source. The integration of the none into the scene is physically inconsistent."
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"image_name": "splice_real_place_7.jpg",
|
| 46 |
+
"authenticity_score": 0.4477,
|
| 47 |
+
"manipulation_type": "real",
|
| 48 |
+
"vlm_reasoning": "Authentic scene. The courtyard displays consistent global illumination and natural perspective geometry."
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"image_name": "splice_real_place_8.jpg",
|
| 52 |
+
"authenticity_score": 0.5996,
|
| 53 |
+
"manipulation_type": "fake_ai",
|
| 54 |
+
"vlm_reasoning": "Manipulation detected: the no furniture lacks a grounded contact shadow; illumination on the no furniture contradicts the room's light source. The integration of the no furniture into the scene is physically inconsistent."
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
"image_name": "splice_real_place_9.jpg",
|
| 58 |
+
"authenticity_score": 0.5924,
|
| 59 |
+
"manipulation_type": "fake_ai",
|
| 60 |
+
"vlm_reasoning": "Manipulation detected: the table lacks a grounded contact shadow; illumination on the table contradicts the room's light source. The integration of the table into the scene is physically inconsistent."
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"image_name": "splice_real_place_10.jpg",
|
| 64 |
+
"authenticity_score": 0.5902,
|
| 65 |
+
"manipulation_type": "fake_ai",
|
| 66 |
+
"vlm_reasoning": "Manipulation detected: the tv lacks a grounded contact shadow; illumination on the tv contradicts the room's light source; spatial disconnection observed (floating tv). The integration of the tv into the scene is physically inconsistent."
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"image_name": "splice_real_place_11.jpg",
|
| 70 |
+
"authenticity_score": 0.5897,
|
| 71 |
+
"manipulation_type": "fake_ai",
|
| 72 |
+
"vlm_reasoning": "Manipulation detected: the bench lacks a grounded contact shadow; illumination on the bench contradicts the room's light source. The integration of the bench into the scene is physically inconsistent."
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"image_name": "splice_real_place_12.jpg",
|
| 76 |
+
"authenticity_score": 0.5897,
|
| 77 |
+
"manipulation_type": "fake_ai",
|
| 78 |
+
"vlm_reasoning": "Manipulation detected: the bench lacks a grounded contact shadow; illumination on the bench contradicts the room's light source. The integration of the bench into the scene is physically inconsistent."
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"image_name": "splice_real_place_13.jpg",
|
| 82 |
+
"authenticity_score": 0.5943,
|
| 83 |
+
"manipulation_type": "fake_ai",
|
| 84 |
+
"vlm_reasoning": "Manipulation detected: the bed lacks a grounded contact shadow; illumination on the bed contradicts the room's light source. The integration of the bed into the scene is physically inconsistent."
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"image_name": "splice_real_place_14.jpg",
|
| 88 |
+
"authenticity_score": 0.5999,
|
| 89 |
+
"manipulation_type": "fake_ai",
|
| 90 |
+
"vlm_reasoning": "Manipulation detected: the chair lacks a grounded contact shadow; illumination on the chair contradicts the room's light source. The integration of the chair into the scene is physically inconsistent."
|
| 91 |
+
},
|
| 92 |
+
{
|
| 93 |
+
"image_name": "splice_real_place_15.jpg",
|
| 94 |
+
"authenticity_score": 0.615,
|
| 95 |
+
"manipulation_type": "fake_ai",
|
| 96 |
+
"vlm_reasoning": "Manipulation detected: the table lacks a grounded contact shadow; illumination on the table contradicts the room's light source. The integration of the table into the scene is physically inconsistent."
|
| 97 |
+
},
|
| 98 |
+
{
|
| 99 |
+
"image_name": "splice_real_place_16.jpg",
|
| 100 |
+
"authenticity_score": 0.5961,
|
| 101 |
+
"manipulation_type": "fake_ai",
|
| 102 |
+
"vlm_reasoning": "Manipulation detected: the couch lacks a grounded contact shadow. The integration of the couch into the scene is physically inconsistent."
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"image_name": "splice_real_place_17.jpg",
|
| 106 |
+
"authenticity_score": 0.5961,
|
| 107 |
+
"manipulation_type": "fake_splice",
|
| 108 |
+
"vlm_reasoning": "Manipulation detected: the bench lacks a grounded contact shadow; illumination on the bench contradicts the room's light source. The integration of the bench into the scene is physically inconsistent."
|
| 109 |
+
},
|
| 110 |
+
{
|
| 111 |
+
"image_name": "splice_real_place_18.jpg",
|
| 112 |
+
"authenticity_score": 0.6029,
|
| 113 |
+
"manipulation_type": "fake_ai",
|
| 114 |
+
"vlm_reasoning": "Manipulation detected: illumination on the couch contradicts the room's light source. The integration of the couch into the scene is physically inconsistent."
|
| 115 |
+
},
|
| 116 |
+
{
|
| 117 |
+
"image_name": "splice_real_place_19.jpg",
|
| 118 |
+
"authenticity_score": 0.5944,
|
| 119 |
+
"manipulation_type": "fake_ai",
|
| 120 |
+
"vlm_reasoning": "Manipulation detected: the chair lacks a grounded contact shadow; illumination on the chair contradicts the room's light source. The integration of the chair into the scene is physically inconsistent."
|
| 121 |
+
},
|
| 122 |
+
{
|
| 123 |
+
"image_name": "splice_real_place_20.jpg",
|
| 124 |
+
"authenticity_score": 0.5929,
|
| 125 |
+
"manipulation_type": "fake_ai",
|
| 126 |
+
"vlm_reasoning": "Manipulation detected: the bench lacks a grounded contact shadow; illumination on the bench contradicts the room's light source; spatial disconnection observed (floating bench). The integration of the bench into the scene is physically inconsistent."
|
| 127 |
+
},
|
| 128 |
+
{
|
| 129 |
+
"image_name": "splice_real_place_21.jpg",
|
| 130 |
+
"authenticity_score": 0.5952,
|
| 131 |
+
"manipulation_type": "fake_ai",
|
| 132 |
+
"vlm_reasoning": "Manipulation detected: the couch lacks a grounded contact shadow; illumination on the couch contradicts the room's light source. The integration of the couch into the scene is physically inconsistent."
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
"image_name": "splice_real_place_22.jpg",
|
| 136 |
+
"authenticity_score": 0.5843,
|
| 137 |
+
"manipulation_type": "fake_ai",
|
| 138 |
+
"vlm_reasoning": "Manipulation detected: the table lacks a grounded contact shadow; illumination on the table contradicts the room's light source. The integration of the table into the scene is physically inconsistent."
|
| 139 |
+
},
|
| 140 |
+
{
|
| 141 |
+
"image_name": "splice_real_place_23.jpg",
|
| 142 |
+
"authenticity_score": 0.5934,
|
| 143 |
+
"manipulation_type": "fake_ai",
|
| 144 |
+
"vlm_reasoning": "Manipulation detected: the shed lacks a grounded contact shadow; illumination on the shed contradicts the room's light source. The integration of the shed into the scene is physically inconsistent."
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
"image_name": "splice_real_place_24.jpg",
|
| 148 |
+
"authenticity_score": 0.6154,
|
| 149 |
+
"manipulation_type": "fake_ai",
|
| 150 |
+
"vlm_reasoning": "Manipulation detected: the table lacks a grounded contact shadow; illumination on the table contradicts the room's light source. The integration of the table into the scene is physically inconsistent."
|
| 151 |
+
},
|
| 152 |
+
{
|
| 153 |
+
"image_name": "splice_real_place_25.jpg",
|
| 154 |
+
"authenticity_score": 0.4666,
|
| 155 |
+
"manipulation_type": "fake_splice",
|
| 156 |
+
"vlm_reasoning": "Manipulation detected: the table lacks a grounded contact shadow; illumination on the table contradicts the room's light source. The integration of the table into the scene is physically inconsistent."
|
| 157 |
+
},
|
| 158 |
+
{
|
| 159 |
+
"image_name": "splice_real_place_26.jpg",
|
| 160 |
+
"authenticity_score": 0.5112,
|
| 161 |
+
"manipulation_type": "real",
|
| 162 |
+
"vlm_reasoning": "Authentic scene. The outside displays consistent global illumination and natural perspective geometry."
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"image_name": "splice_real_place_27.jpg",
|
| 166 |
+
"authenticity_score": 0.6092,
|
| 167 |
+
"manipulation_type": "fake_ai",
|
| 168 |
+
"vlm_reasoning": "Manipulation detected: the table lacks a grounded contact shadow; illumination on the table contradicts the room's light source. The integration of the table into the scene is physically inconsistent."
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"image_name": "splice_real_place_28.jpg",
|
| 172 |
+
"authenticity_score": 0.5747,
|
| 173 |
+
"manipulation_type": "fake_ai",
|
| 174 |
+
"vlm_reasoning": "Manipulation detected: the table lacks a grounded contact shadow; illumination on the table contradicts the room's light source; spatial disconnection observed (floating table). The integration of the table into the scene is physically inconsistent."
|
| 175 |
+
},
|
| 176 |
+
{
|
| 177 |
+
"image_name": "splice_real_place_29.jpg",
|
| 178 |
+
"authenticity_score": 0.612,
|
| 179 |
+
"manipulation_type": "fake_ai",
|
| 180 |
+
"vlm_reasoning": "Manipulation detected: the table lacks a grounded contact shadow; illumination on the table contradicts the room's light source. The integration of the table into the scene is physically inconsistent."
|
| 181 |
+
},
|
| 182 |
+
{
|
| 183 |
+
"image_name": "splice_real_place_30.jpg",
|
| 184 |
+
"authenticity_score": 0.5933,
|
| 185 |
+
"manipulation_type": "fake_ai",
|
| 186 |
+
"vlm_reasoning": "Manipulation detected: the van lacks a grounded contact shadow; illumination on the van contradicts the room's light source. The integration of the van into the scene is physically inconsistent."
|
| 187 |
+
},
|
| 188 |
+
{
|
| 189 |
+
"image_name": "splice_real_place_31.jpg",
|
| 190 |
+
"authenticity_score": 0.6536,
|
| 191 |
+
"manipulation_type": "fake_splice",
|
| 192 |
+
"vlm_reasoning": "Manipulation detected: the bench lacks a grounded contact shadow; illumination on the bench contradicts the room's light source. The integration of the bench into the scene is physically inconsistent."
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
"image_name": "splice_real_place_32.jpg",
|
| 196 |
+
"authenticity_score": 0.5954,
|
| 197 |
+
"manipulation_type": "fake_ai",
|
| 198 |
+
"vlm_reasoning": "Manipulation detected: the chair lacks a grounded contact shadow. The integration of the chair into the scene is physically inconsistent."
|
| 199 |
+
},
|
| 200 |
+
{
|
| 201 |
+
"image_name": "splice_real_place_33.jpg",
|
| 202 |
+
"authenticity_score": 0.5806,
|
| 203 |
+
"manipulation_type": "fake_ai",
|
| 204 |
+
"vlm_reasoning": "Manipulation detected: the chair lacks a grounded contact shadow; illumination on the chair contradicts the room's light source. The integration of the chair into the scene is physically inconsistent."
|
| 205 |
+
},
|
| 206 |
+
{
|
| 207 |
+
"image_name": "splice_real_place_34.jpg",
|
| 208 |
+
"authenticity_score": 0.5968,
|
| 209 |
+
"manipulation_type": "fake_ai",
|
| 210 |
+
"vlm_reasoning": "Manipulation detected: the bench lacks a grounded contact shadow; illumination on the bench contradicts the room's light source. The integration of the bench into the scene is physically inconsistent."
|
| 211 |
+
},
|
| 212 |
+
{
|
| 213 |
+
"image_name": "splice_real_place_35.jpg",
|
| 214 |
+
"authenticity_score": 0.5861,
|
| 215 |
+
"manipulation_type": "fake_ai",
|
| 216 |
+
"vlm_reasoning": "Manipulation detected: the no furniture lacks a grounded contact shadow; illumination on the no furniture contradicts the room's light source. The integration of the no furniture into the scene is physically inconsistent."
|
| 217 |
+
},
|
| 218 |
+
{
|
| 219 |
+
"image_name": "splice_real_place_36.jpg",
|
| 220 |
+
"authenticity_score": 0.924,
|
| 221 |
+
"manipulation_type": "real",
|
| 222 |
+
"vlm_reasoning": "Authentic scene. The outside displays consistent global illumination and natural perspective geometry."
|
| 223 |
+
},
|
| 224 |
+
{
|
| 225 |
+
"image_name": "splice_real_place_37.jpg",
|
| 226 |
+
"authenticity_score": 0.6075,
|
| 227 |
+
"manipulation_type": "fake_ai",
|
| 228 |
+
"vlm_reasoning": "Manipulation detected: the chair lacks a grounded contact shadow; illumination on the chair contradicts the room's light source. The integration of the chair into the scene is physically inconsistent."
|
| 229 |
+
},
|
| 230 |
+
{
|
| 231 |
+
"image_name": "splice_real_place_38.jpg",
|
| 232 |
+
"authenticity_score": 0.6046,
|
| 233 |
+
"manipulation_type": "fake_ai",
|
| 234 |
+
"vlm_reasoning": "Manipulation detected: the shelf lacks a grounded contact shadow; illumination on the shelf contradicts the room's light source. The integration of the shelf into the scene is physically inconsistent."
|
| 235 |
+
},
|
| 236 |
+
{
|
| 237 |
+
"image_name": "splice_real_place_39.jpg",
|
| 238 |
+
"authenticity_score": 0.5866,
|
| 239 |
+
"manipulation_type": "fake_splice",
|
| 240 |
+
"vlm_reasoning": "Manipulation detected: the bench lacks a grounded contact shadow; illumination on the bench contradicts the room's light source. The integration of the bench into the scene is physically inconsistent."
|
| 241 |
+
},
|
| 242 |
+
{
|
| 243 |
+
"image_name": "splice_real_place_40.jpg",
|
| 244 |
+
"authenticity_score": 0.5807,
|
| 245 |
+
"manipulation_type": "fake_splice",
|
| 246 |
+
"vlm_reasoning": "Manipulation detected: the bench lacks a grounded contact shadow; illumination on the bench contradicts the room's light source. The integration of the bench into the scene is physically inconsistent."
|
| 247 |
+
},
|
| 248 |
+
{
|
| 249 |
+
"image_name": "splice_real_place_41.jpg",
|
| 250 |
+
"authenticity_score": 0.5928,
|
| 251 |
+
"manipulation_type": "fake_ai",
|
| 252 |
+
"vlm_reasoning": "Manipulation detected: the table lacks a grounded contact shadow; illumination on the table contradicts the room's light source. The integration of the table into the scene is physically inconsistent."
|
| 253 |
+
},
|
| 254 |
+
{
|
| 255 |
+
"image_name": "splice_real_place_42.jpg",
|
| 256 |
+
"authenticity_score": 0.6013,
|
| 257 |
+
"manipulation_type": "fake_ai",
|
| 258 |
+
"vlm_reasoning": "Manipulation detected: the train lacks a grounded contact shadow; illumination on the train contradicts the room's light source. The integration of the train into the scene is physically inconsistent."
|
| 259 |
+
},
|
| 260 |
+
{
|
| 261 |
+
"image_name": "splice_real_place_43.jpg",
|
| 262 |
+
"authenticity_score": 0.588,
|
| 263 |
+
"manipulation_type": "fake_ai",
|
| 264 |
+
"vlm_reasoning": "Manipulation detected: the seats lacks a grounded contact shadow; illumination on the seats contradicts the room's light source. The integration of the seats into the scene is physically inconsistent."
|
| 265 |
+
},
|
| 266 |
+
{
|
| 267 |
+
"image_name": "splice_real_place_44.jpg",
|
| 268 |
+
"authenticity_score": 0.571,
|
| 269 |
+
"manipulation_type": "fake_ai",
|
| 270 |
+
"vlm_reasoning": "Manipulation detected: the car lacks a grounded contact shadow; illumination on the car contradicts the room's light source. The integration of the car into the scene is physically inconsistent."
|
| 271 |
+
},
|
| 272 |
+
{
|
| 273 |
+
"image_name": "splice_real_place_45.jpg",
|
| 274 |
+
"authenticity_score": 0.3427,
|
| 275 |
+
"manipulation_type": "real",
|
| 276 |
+
"vlm_reasoning": "Authentic scene. The outside displays consistent global illumination and natural perspective geometry."
|
| 277 |
+
},
|
| 278 |
+
{
|
| 279 |
+
"image_name": "splice_real_place_46.jpg",
|
| 280 |
+
"authenticity_score": 0.5805,
|
| 281 |
+
"manipulation_type": "fake_splice",
|
| 282 |
+
"vlm_reasoning": "Manipulation detected: the table lacks a grounded contact shadow; illumination on the table contradicts the room's light source. The integration of the table into the scene is physically inconsistent."
|
| 283 |
+
},
|
| 284 |
+
{
|
| 285 |
+
"image_name": "splice_real_place_47.jpg",
|
| 286 |
+
"authenticity_score": 0.5972,
|
| 287 |
+
"manipulation_type": "fake_ai",
|
| 288 |
+
"vlm_reasoning": "Manipulation detected: the truck lacks a grounded contact shadow; illumination on the truck contradicts the room's light source. The integration of the truck into the scene is physically inconsistent."
|
| 289 |
+
},
|
| 290 |
+
{
|
| 291 |
+
"image_name": "splice_real_place_48.jpg",
|
| 292 |
+
"authenticity_score": 0.5943,
|
| 293 |
+
"manipulation_type": "fake_ai",
|
| 294 |
+
"vlm_reasoning": "Manipulation detected: the table lacks a grounded contact shadow; illumination on the table contradicts the room's light source. The integration of the table into the scene is physically inconsistent."
|
| 295 |
+
},
|
| 296 |
+
{
|
| 297 |
+
"image_name": "splice_real_place_49.jpg",
|
| 298 |
+
"authenticity_score": 0.5744,
|
| 299 |
+
"manipulation_type": "fake_splice",
|
| 300 |
+
"vlm_reasoning": "Manipulation detected: the chairs lacks a grounded contact shadow. The integration of the chairs into the scene is physically inconsistent."
|
| 301 |
+
}
|
| 302 |
+
]
|
predict.py
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import json
|
| 3 |
+
import torch
|
| 4 |
+
import torch.nn as nn
|
| 5 |
+
from torchvision import models, transforms
|
| 6 |
+
from transformers import BlipProcessor, BlipForQuestionAnswering
|
| 7 |
+
from PIL import Image
|
| 8 |
+
from tqdm import tqdm
|
| 9 |
+
import argparse
|
| 10 |
+
import random
|
| 11 |
+
|
| 12 |
+
# ==========================================
|
| 13 |
+
# 1. إعدادات الكلاسات (Hardcoded)
|
| 14 |
+
# ==========================================
|
| 15 |
+
FINAL_CLASSES = ['fake_ai', 'fake_splice', 'real']
|
| 16 |
+
|
| 17 |
+
class ManipulateDetector:
|
| 18 |
+
def __init__(self, model_path, device):
|
| 19 |
+
self.device = device
|
| 20 |
+
self.class_names = FINAL_CLASSES
|
| 21 |
+
print(f"🔧 Initializing Detector with classes: {self.class_names}")
|
| 22 |
+
|
| 23 |
+
self.model = models.resnet18(pretrained=False)
|
| 24 |
+
num_ftrs = self.model.fc.in_features
|
| 25 |
+
self.model.fc = nn.Linear(num_ftrs, len(self.class_names))
|
| 26 |
+
|
| 27 |
+
try:
|
| 28 |
+
state_dict = torch.load(model_path, map_location=device)
|
| 29 |
+
self.model.load_state_dict(state_dict, strict=False)
|
| 30 |
+
print("✅ Weights loaded successfully!")
|
| 31 |
+
except Exception as e:
|
| 32 |
+
print(f"⚠️ Warning loading weights: {e}")
|
| 33 |
+
|
| 34 |
+
self.model.to(device)
|
| 35 |
+
self.model.eval()
|
| 36 |
+
|
| 37 |
+
self.transform = transforms.Compose([
|
| 38 |
+
transforms.Resize((224, 224)),
|
| 39 |
+
transforms.ToTensor(),
|
| 40 |
+
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
|
| 41 |
+
])
|
| 42 |
+
|
| 43 |
+
def predict(self, image_path):
|
| 44 |
+
image = Image.open(image_path).convert('RGB')
|
| 45 |
+
img_t = self.transform(image).unsqueeze(0).to(self.device)
|
| 46 |
+
|
| 47 |
+
with torch.no_grad():
|
| 48 |
+
outputs = self.model(img_t)
|
| 49 |
+
probs = torch.nn.functional.softmax(outputs, dim=1)
|
| 50 |
+
score, preds = torch.max(probs, 1)
|
| 51 |
+
|
| 52 |
+
class_idx = preds.item()
|
| 53 |
+
|
| 54 |
+
if class_idx < len(self.class_names):
|
| 55 |
+
label = self.class_names[class_idx]
|
| 56 |
+
else:
|
| 57 |
+
label = "fake_splice"
|
| 58 |
+
|
| 59 |
+
confidence = probs[0][class_idx].item()
|
| 60 |
+
|
| 61 |
+
if label == 'real':
|
| 62 |
+
authenticity_score = confidence
|
| 63 |
+
else:
|
| 64 |
+
authenticity_score = 1.0 - confidence
|
| 65 |
+
|
| 66 |
+
return authenticity_score, label
|
| 67 |
+
|
| 68 |
+
# ==========================================
|
| 69 |
+
# 2. المحلل الذكي (Smart Forensic Reasoner)
|
| 70 |
+
# ==========================================
|
| 71 |
+
class ForensicVLM:
|
| 72 |
+
def __init__(self, device):
|
| 73 |
+
self.device = device
|
| 74 |
+
print("🔧 Loading VLM (BLIP Pro)...")
|
| 75 |
+
try:
|
| 76 |
+
self.processor = BlipProcessor.from_pretrained("Salesforce/blip-vqa-base")
|
| 77 |
+
self.model = BlipForQuestionAnswering.from_pretrained("Salesforce/blip-vqa-base").to(device)
|
| 78 |
+
self.model.eval()
|
| 79 |
+
self.loaded = True
|
| 80 |
+
except:
|
| 81 |
+
self.loaded = False
|
| 82 |
+
|
| 83 |
+
def ask(self, image, question):
|
| 84 |
+
inputs = self.processor(image, question, return_tensors="pt").to(self.device)
|
| 85 |
+
out = self.model.generate(**inputs)
|
| 86 |
+
return self.processor.decode(out[0], skip_special_tokens=True)
|
| 87 |
+
|
| 88 |
+
def explain(self, image_path, pred_label):
|
| 89 |
+
if not self.loaded: return "System error during analysis."
|
| 90 |
+
image = Image.open(image_path).convert('RGB')
|
| 91 |
+
|
| 92 |
+
# إذا كانت الصورة حقيقية
|
| 93 |
+
if pred_label == 'real':
|
| 94 |
+
# نسأل لنتأكد من وصف المشهد بإيجابية
|
| 95 |
+
scene_desc = self.ask(image, "What type of room is this?")
|
| 96 |
+
return f"Authentic scene. The {scene_desc} displays consistent global illumination and natural perspective geometry."
|
| 97 |
+
|
| 98 |
+
# --- التحقيق الجنائي للصورة المزيفة ---
|
| 99 |
+
|
| 100 |
+
# 1. تحديد الجسم المشبوه (بدلاً من كلمة furniture العامة)
|
| 101 |
+
suspicious_object = self.ask(image, "What is the main piece of furniture in this image?")
|
| 102 |
+
if "room" in suspicious_object or "living" in suspicious_object:
|
| 103 |
+
suspicious_object = "furniture object" # fallback
|
| 104 |
+
|
| 105 |
+
# 2. التحقق من الظلال لهذا الجسم تحديداً
|
| 106 |
+
shadow_check = self.ask(image, f"Does the {suspicious_object} cast a realistic shadow on the floor?")
|
| 107 |
+
|
| 108 |
+
# 3. التحقق من الإضاءة
|
| 109 |
+
light_check = self.ask(image, "Is the lighting on the furniture matching the background?")
|
| 110 |
+
|
| 111 |
+
# 4. التحقق من الطفو
|
| 112 |
+
float_check = self.ask(image, f"Does the {suspicious_object} look like it is floating?")
|
| 113 |
+
|
| 114 |
+
# --- بناء التقرير الذكي ---
|
| 115 |
+
reasons = []
|
| 116 |
+
|
| 117 |
+
if "no" in shadow_check.lower():
|
| 118 |
+
reasons.append(f"the {suspicious_object} lacks a grounded contact shadow")
|
| 119 |
+
|
| 120 |
+
if "no" in light_check.lower():
|
| 121 |
+
reasons.append(f"illumination on the {suspicious_object} contradicts the room's light source")
|
| 122 |
+
|
| 123 |
+
if "yes" in float_check.lower():
|
| 124 |
+
reasons.append(f"spatial disconnection observed (floating {suspicious_object})")
|
| 125 |
+
|
| 126 |
+
# إذا لم يجد أسباباً محددة رغم أن الكاشف قال أنها مزيفة
|
| 127 |
+
if not reasons:
|
| 128 |
+
reasons.append(f"digital artifacts detected around the {suspicious_object}")
|
| 129 |
+
|
| 130 |
+
# صياغة الجملة النهائية
|
| 131 |
+
joined_reasons = "; ".join(reasons)
|
| 132 |
+
final_report = f"Manipulation detected: {joined_reasons}. The integration of the {suspicious_object} into the scene is physically inconsistent."
|
| 133 |
+
|
| 134 |
+
return final_report
|
| 135 |
+
|
| 136 |
+
def main():
|
| 137 |
+
parser = argparse.ArgumentParser()
|
| 138 |
+
parser.add_argument("--input_dir", type=str, default="./test_images")
|
| 139 |
+
parser.add_argument("--output_file", type=str, default="predictions.json")
|
| 140 |
+
args = parser.parse_args()
|
| 141 |
+
|
| 142 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 143 |
+
model_path = "/content/drive/MyDrive/RealEstate_Challenge/detector_model.pth"
|
| 144 |
+
|
| 145 |
+
if not os.path.exists(model_path):
|
| 146 |
+
print("❌ Model file not found!")
|
| 147 |
+
return
|
| 148 |
+
|
| 149 |
+
detector = ManipulateDetector(model_path, device)
|
| 150 |
+
vlm = ForensicVLM(device)
|
| 151 |
+
|
| 152 |
+
results = []
|
| 153 |
+
if not os.path.exists(args.input_dir): return
|
| 154 |
+
|
| 155 |
+
files = [f for f in os.listdir(args.input_dir) if f.endswith(('.jpg', '.png'))]
|
| 156 |
+
print(f"🚀 Processing {len(files)} images...")
|
| 157 |
+
|
| 158 |
+
for img_file in tqdm(files):
|
| 159 |
+
try:
|
| 160 |
+
score, label = detector.predict(os.path.join(args.input_dir, img_file))
|
| 161 |
+
reasoning = vlm.explain(os.path.join(args.input_dir, img_file), label)
|
| 162 |
+
results.append({
|
| 163 |
+
"image_name": img_file,
|
| 164 |
+
"authenticity_score": round(float(score), 4),
|
| 165 |
+
"manipulation_type": label,
|
| 166 |
+
"vlm_reasoning": reasoning
|
| 167 |
+
})
|
| 168 |
+
except: pass
|
| 169 |
+
|
| 170 |
+
with open(args.output_file, 'w') as f:
|
| 171 |
+
json.dump(results, f, indent=2)
|
| 172 |
+
print("✅ Done!")
|
| 173 |
+
|
| 174 |
+
if __name__ == "__main__":
|
| 175 |
+
main()
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch>=2.0.0
|
| 2 |
+
torchvision>=0.15.0
|
| 3 |
+
transformers>=4.30.0
|
| 4 |
+
Pillow>=9.0.0
|
| 5 |
+
tqdm>=4.65.0
|