Views
No views yet
1 ┌─────────────────┐
2 │ Original Image │
3 └────────┬────────┘
4 │
5 resize / preview
6 │
7 ▼
8 ┌──────────────────┐
9 │ RGB 224 × 224 │
10 └────────┬─────────┘
11 │
12 ┌───────────────┴───────────────┐
13 │ │
14 Image Features Style ID
15 │ 0 ... 5
16 └───────────────┬───────────────┘
17 ▼
18 ┌──────────────────┐
19 │ AdaptivePhotoNet │
20 │ 5.88M params │
21 └────────┬─────────┘
22 │
23 ┌──────────┴──────────┐
24 ▼ ▼
25 21D Retouch Recipe 10 Scene Scores
26 │
27 ▼
28 Deterministic Retouching
29 Pipeline
30 │
31 ▼
32 Full-Resolution Output Image
33
34The neural network therefore does not need to reconstruct the full-resolution photograph.
35
36It predicts how the photograph should be adjusted, while the final rendering is performed by conventional image-processing operations.
37
38This design has several practical advantages:
39
40low neural-network inference cost;
41
42processing is independent of the original image resolution at the model stage;
43
44deterministic full-resolution rendering;
45
46compact ONNX deployment;
47
48interpretable adjustment parameters;
49
50selectable photographic styles;
51
52suitable for mobile and edge applications.
53
54
55
56---
57
58Model Specifications
59
60Property Value
61
62Model AdaptivePhotoNet
63Parameters 5,876,943
64Model input resolution 224 × 224
65Image format RGB
66Tensor layout NCHW
67Image dtype float32
68Image range [0.0, 1.0]
69Style input int64
70Number of styles 6
71Recipe output 21 dimensions
72Scene output 10 dimensions
73Runtime format ONNX
74
75
76
77---
78
79Inputs
80
81Image
82
83name: image
84shape: [1, 3, 224, 224]
85dtype: float32
86layout: NCHW
87color: RGB
88range: 0.0 - 1.0
89
90The original photograph should be converted to RGB, resized to 224 × 224, converted to float32, normalized to [0, 1], and arranged in NCHW format.
91
92The 224 × 224 image is used for analysis only.
93
94The final retouching operations can be applied separately to the original full-resolution photograph.
95
96Style
97
98name: style_id
99shape: [1]
100dtype: int64
101
102ID Style
103
1040 Natural
1051 Vivid
1062 Cinema
1073 Portrait
1084 Film
1095 Moody
110
111
112Changing style_id instructs the same model to predict a different retouching direction for the input photograph.
113
114
115---
116
117Outputs
118
119AdaptivePhotoNet produces two outputs.
120
1211. Retouching Recipe
122
123shape: [1, 21]
124
125The 21-dimensional vector describes the photographic adjustments that should be applied by the retouching engine.
126
127Linear Parameters
128
129Dimensions 0–16 represent:
130
131Dim Parameter Range
132
1330 Exposure EV -2.0 → 2.0
1341 Temperature -1.0 → 1.0
1352 Tint -1.0 → 1.0
1363 Shadows -1.0 → 1.0
1374 Highlights -1.0 → 1.0
1385 Contrast -1.0 → 1.0
1396 Tone Curve 0 0.0 → 1.0
1407 Tone Curve 1 0.0 → 1.0
1418 Tone Curve 2 0.0 → 1.0
1429 Tone Curve 3 0.0 → 1.0
14310 Tone Curve 4 0.0 → 1.0
14411 Shadow Tone Strength 0.0 → 0.3
14512 Highlight Tone Strength 0.0 → 0.3
14613 Saturation -1.0 → 1.0
14714 Vibrance -1.0 → 1.0
14815 Fade 0.0 → 1.0
14916 Vignette 0.0 → 1.0
150
151
152Hue Parameters
153
154Hue is represented circularly using sine/cosine pairs rather than a single scalar value.
155
15617, 18 → shadow_tone_hue [sin, cos]
15719, 20 → highlight_tone_hue [sin, cos]
158
159This avoids the discontinuity that occurs when representing circular hue values directly near the angle boundary.
160
161The complete interpretation is defined in:
162
163recipe_schema.json
164
165
166---
167
1682. Scene Probabilities
169
170shape: [1, 10]
171
172The auxiliary scene head predicts ten visual attributes:
173
174Index Scene Attribute
175
1760 Human
1771 Face Visible
1782 Skin Visible
1793 Portrait
1804 Indoor
1815 Outdoor
1826 Night
1837 Low Light
1848 Backlit
1859 High Dynamic Range
186
187
188These attributes provide additional scene understanding alongside the retouching prediction.
189
190They can also be useful for debugging, analysis, UI features, or future scene-aware processing logic.
191
192
193---
194
195Why Predict a Recipe Instead of Pixels?
196
197Many neural photo-enhancement systems directly generate a complete output image.
198
199AdaptivePhotoNet takes a different approach.
200
201Pixel-to-pixel model:
202
203Full Image → Neural Network → Full Image
204
205
206AdaptivePhotoNet:
207
208Small Preview → Neural Network → 21 Parameters
209 ↓
210Original Full-Resolution Image → Retouching Engine → Output
211
212For photographic retouching, much of the desired transformation can be expressed through global or structured photographic controls.
213
214Predicting these controls instead of millions of output pixels allows the neural network to remain relatively small.
215
216It also keeps the transformation interpretable.
217
218For example, an application can inspect whether the network requested:
219
220Exposure +0.32 EV
221Temperature -0.08
222Highlights -0.21
223Contrast +0.14
224Saturation +0.07
225Vignette 0.11
226...
227
228rather than receiving only an opaque generated image.
229
230
231---
232
233Multi-Style Retouching
234
235AdaptivePhotoNet uses a separate style_id input rather than requiring six independent models.
236
237The same photograph can therefore be analyzed under different retouching directions:
238
239┌─ Natural
240 ├─ Vivid
241Input Photograph ───├─ Cinema
242 ├─ Portrait
243 ├─ Film
244 └─ Moody
245
246The style determines the intended aesthetic direction while the image content determines the actual adjustment recipe.
247
248This means that Film, for example, is not intended to represent one fixed preset applied identically to every photograph.
249
250Two photographs using the same style may receive different exposure, tone, color, curve, and other adjustments according to their visual characteristics.
251
252
253---
254
255Training Dataset
256
257AdaptivePhotoNet was developed together with:
258
259Adaptive Photo Retouching 6-Style Dataset
260
261https://huggingface.co/datasets/Phitran21/adaptive-photo-retouching-6style
262
263The dataset contains original photographs paired with six adaptively retouched variants:
264
265Original
266├── Natural
267├── Vivid
268├── Cinema
269├── Portrait
270├── Film
271└── Moody
272
273The target transformations were generated adaptively for individual images rather than by applying six globally fixed presets.
274
275See the dataset card for details about dataset generation, source data, licensing, and limitations.
276
277
278---
279
280Inference Pipeline
281
282A typical application pipeline is:
283
2841. Load the original image
285 ↓
2862. Create 224 × 224 RGB preview
287 ↓
2883. Normalize to float32 [0, 1]
289 ↓
2904. Convert HWC → NCHW
291 ↓
2925. Select style_id
293 ↓
2946. Run AdaptivePhotoNet
295 ↓
2967. Decode the 21D recipe
297 ↓
2988. Apply recipe to original-resolution image
299 ↓
3009. Produce final retouched photograph
301
302The original full-resolution image does not need to pass through the neural network.
303
304
305---
306
307Minimal ONNX Runtime Example
308
309import numpy as np
310import onnxruntime as ort
311from PIL import Image
312
313STYLE = {
314 "natural": 0,
315 "vivid": 1,
316 "cinema": 2,
317 "portrait": 3,
318 "film": 4,
319 "moody": 5,
320}
321
322image = Image.open("photo.jpg").convert("RGB")
323preview = image.resize((224, 224))
324
325x = np.asarray(preview, dtype=np.float32) / 255.0
326x = np.transpose(x, (2, 0, 1))
327x = np.expand_dims(x, axis=0)
328
329style_id = np.asarray([STYLE["film"]], dtype=np.int64)
330
331session = ort.InferenceSession("AdaptivePhotoNet.onnx")
332
333recipe_vector, scene_probs = session.run(
334 None,
335 {
336 "image": x,
337 "style_id": style_id,
338 },
339)
340
341print("Recipe:", recipe_vector)
342print("Scene probabilities:", scene_probs)
343
344The resulting recipe_vector must then be interpreted according to recipe_schema.json and applied by the corresponding image-retouching pipeline.
345
346
347---
348
349Android / ONNX Runtime
350
351Recommended execution-provider configuration:
352
353FP32
354
355XNNPACKExecutionProvider
356 ↓ fallback
357CPUExecutionProvider
358
359INT8
360
361CPUExecutionProvider
362
363Actual performance depends on device hardware, ONNX Runtime version, thread configuration, quantization method, and preprocessing pipeline.
364
365
366---
367
368Intended Use
369
370AdaptivePhotoNet is intended for experimentation and development in:
371
372automatic photo retouching;
373
374computational photography;
375
376adaptive color grading;
377
378scene-aware image enhancement;
379
380mobile photo editing;
381
382lightweight computer vision;
383
384ONNX Runtime applications;
385
386edge inference;
387
388non-destructive image adjustment prediction.
389
390
391
392---
393
394Limitations
395
396AdaptivePhotoNet predicts photographic adjustments from a 224 × 224 representation of the image.
397
398Fine details that disappear during resizing may therefore not influence the predicted recipe.
399
400The model may also perform less reliably on images significantly outside its training distribution, including unusual lighting, extreme exposure, uncommon photographic styles, or heavily degraded images.
401
402Retouching quality is inherently subjective. Different users may prefer different photographic interpretations of the same image.
403
404The six supported styles represent only six predefined aesthetic directions and should not be interpreted as exhaustive photographic styles.
405
406The model predicts retouching parameters rather than reconstructing or generating image content. It therefore cannot perform tasks such as object removal, image inpainting, semantic image editing, or generative relighting.
407
408
409---
410
411Related Resources
412
413Training Dataset
414
415Adaptive Photo Retouching 6-Style Dataset
416
417https://huggingface.co/datasets/Phitran21/adaptive-photo-retouching-6style
418
419Source Code and Demo
420
421https://github.com/phiiggfdg/adaptive-retouch-6m-onnx
422
423
424---
425
426Author
427
428Trần Phi
429
430Hugging Face:
431https://huggingface.co/Phitran21
432
433GitHub:
434https://github.com/phiiggfdg
435
436Website:
437https://toren.io.vn
438
439
440---