Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Finding Incompatible JPEG Blocks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Levecque Etienne
Finding Incompatible JPEG Blocks
Commits
0bf62ade
Commit
0bf62ade
authored
May 31, 2024
by
Levecque Etienne
Browse files
Options
Downloads
Patches
Plain Diff
feat: improve pipeline arguments and README.md about pipelines
parent
aefdbc22
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+17
-2
17 additions, 2 deletions
README.md
antecedent/pipeline.py
+5
-5
5 additions, 5 deletions
antecedent/pipeline.py
with
22 additions
and
7 deletions
README.md
+
17
−
2
View file @
0bf62ade
...
...
@@ -38,6 +38,9 @@ path = r"path/to/my/image"
img
=
Image
(
'
toy_image
'
,
path
)
pipeline
=
create_pipeline
(
'
islow
'
,
100
,
img
.
is_grayscale
,
target_is_dct
=
img
.
is_jpeg
)
# Islow pipeline with QF100
# Example for a double compression pipeline:
# pipeline = create_pipeline(['islow', 'naive'], [90,100], img.is_grayscale, target_is_dct=img.is_jpeg)
img
.
set_pipeline
(
pipeline
)
img
.
set_selection_parameter
(
'
random
'
,
10
)
# 10% of the blocks randomly
...
...
@@ -49,6 +52,7 @@ for pos, block in img.block_collection.items():
# 3 if block has been ignored
# 1 if an antecedent has been found
# 0 otherwise (potentially incompatible)
# -1 for incompatible
status
=
block
.
status
[
pipeline
]
antecedent
=
block
.
antecedents
[
pipeline
]
iteration
=
block
.
iterations
[
pipeline
]
...
...
@@ -153,8 +157,8 @@ from antecedent.pipeline import JPEGPipeline
class
YourCustomPipeline
(
JPEGPipeline
):
def
__init__
(
self
,
quality
,
grayscale
):
super
().
__init__
(
'
your_custom_name
'
,
quality
,
grayscale
)
def
__init__
(
self
,
quality
,
grayscale
,
target_is_dct
):
super
().
__init__
(
'
your_custom_name
'
,
quality
,
grayscale
,
target_is_dct
)
@classmethod
def
is_named
(
cls
,
name
):
...
...
@@ -205,6 +209,17 @@ You can define the pipelines in the config file as follows:
pipeline: [naive, islow]
quant_tbl:[75, 98]
Or directly in python as follows:
```
python
from
antecedent.pipeline
import
create_pipeline
grayscale
=
True
# depends on your image/block
target_is_dct
=
True
# depends on your image/block
pipeline
=
create_pipeline
([
'
naive
'
,
'
islow
'
],
[
75
,
98
],
grayscale
=
grayscale
,
target_is_dct
=
target_is_dct
)
```
## Blocks selection and filtering
If you have a JPEG image at QF100 and you want to know if it has been modified, we have shown in our paper that we can
...
...
This diff is collapsed.
Click to expand it.
antecedent/pipeline.py
+
5
−
5
View file @
0bf62ade
...
...
@@ -6,7 +6,7 @@ import numpy as np
class
JPEGPipeline
:
def
__init__
(
self
,
name
,
quality
,
target_is_dct
,
grayscale
,
return_int
,
return_rounded
):
def
__init__
(
self
,
name
,
quality
,
target_is_dct
,
grayscale
,
return_int
=
True
,
return_rounded
=
True
):
self
.
name
=
name
self
.
quality
=
quality
self
.
target_is_dct
=
target_is_dct
...
...
@@ -112,7 +112,7 @@ class JPEGPipeline:
class
NaivePipeline
(
JPEGPipeline
):
def
__init__
(
self
,
quality
,
target_is_dct
,
grayscale
,
return_int
,
return_rounded
):
def
__init__
(
self
,
quality
,
target_is_dct
,
grayscale
,
return_int
=
True
,
return_rounded
=
True
):
super
().
__init__
(
'
naive
'
,
quality
,
target_is_dct
,
grayscale
,
return_int
,
return_rounded
)
@classmethod
...
...
@@ -128,7 +128,7 @@ class NaivePipeline(JPEGPipeline):
class
IslowPipeline
(
JPEGPipeline
):
def
__init__
(
self
,
quality
,
target_is_dct
,
grayscale
,
return_int
,
return_rounded
):
def
__init__
(
self
,
quality
,
target_is_dct
,
grayscale
,
return_int
=
True
,
return_rounded
=
True
):
super
().
__init__
(
'
islow
'
,
quality
,
target_is_dct
,
grayscale
,
return_int
,
return_rounded
)
self
.
return_int
=
return_int
...
...
@@ -157,7 +157,7 @@ class IslowPipeline(JPEGPipeline):
class
IfastPipeline
(
JPEGPipeline
):
def
__init__
(
self
,
quality
,
target_is_dct
,
grayscale
,
return_int
,
return_rounded
):
def
__init__
(
self
,
quality
,
target_is_dct
,
grayscale
,
return_int
=
True
,
return_rounded
=
True
):
super
().
__init__
(
'
ifast
'
,
quality
,
target_is_dct
,
grayscale
,
return_int
,
return_rounded
)
@classmethod
...
...
@@ -173,7 +173,7 @@ class IfastPipeline(JPEGPipeline):
class
FloatPipeline
(
JPEGPipeline
):
def
__init__
(
self
,
quality
,
target_is_dct
,
grayscale
,
return_int
,
return_rounded
):
def
__init__
(
self
,
quality
,
target_is_dct
,
grayscale
,
return_int
=
True
,
return_rounded
=
True
):
super
().
__init__
(
'
float
'
,
quality
,
target_is_dct
,
grayscale
,
return_int
,
return_rounded
)
@classmethod
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment