mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-30 14:57:59 +01:00
decrease sensitivity of duplicate detection and allow picking up existing images as duplicates (derpibooru/philomena#211, booru/philomena#92)
This commit is contained in:
parent
c766ac9d3f
commit
fb39379051
2 changed files with 8 additions and 6 deletions
|
@ -15,9 +15,8 @@ defmodule Philomena.DuplicateReports do
|
||||||
def generate_reports(source) do
|
def generate_reports(source) do
|
||||||
source = Repo.preload(source, :intensity)
|
source = Repo.preload(source, :intensity)
|
||||||
|
|
||||||
duplicates_of(source.intensity, source.image_aspect_ratio, 0.2, 0.05)
|
duplicates_of(source.intensity, source.image_aspect_ratio, 0.5, 0.1)
|
||||||
|> where([i, _it], i.id != ^source.id)
|
|> where([i, _it], i.id != ^source.id)
|
||||||
|> where([i, _it], i.duplication_checked != true)
|
|
||||||
|> Repo.all()
|
|> Repo.all()
|
||||||
|> Enum.map(fn target ->
|
|> Enum.map(fn target ->
|
||||||
create_duplicate_report(source, target, %{}, %{
|
create_duplicate_report(source, target, %{}, %{
|
||||||
|
@ -37,7 +36,7 @@ defmodule Philomena.DuplicateReports do
|
||||||
where:
|
where:
|
||||||
i.image_aspect_ratio >= ^(aspect_ratio - aspect_dist) and
|
i.image_aspect_ratio >= ^(aspect_ratio - aspect_dist) and
|
||||||
i.image_aspect_ratio <= ^(aspect_ratio + aspect_dist),
|
i.image_aspect_ratio <= ^(aspect_ratio + aspect_dist),
|
||||||
limit: 20
|
limit: 10
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|
|
@ -28,8 +28,8 @@ defmodule Philomena.Images.Thumbnailer do
|
||||||
{:ok, analysis} = Analyzers.analyze(file)
|
{:ok, analysis} = Analyzers.analyze(file)
|
||||||
|
|
||||||
apply_edit_script(image, Processors.process(analysis, file, @versions))
|
apply_edit_script(image, Processors.process(analysis, file, @versions))
|
||||||
recompute_meta(image, file, &Image.thumbnail_changeset/2)
|
|
||||||
generate_dupe_reports(image)
|
generate_dupe_reports(image)
|
||||||
|
recompute_meta(image, file, &Image.thumbnail_changeset/2)
|
||||||
|
|
||||||
apply_edit_script(image, Processors.post_process(analysis, file))
|
apply_edit_script(image, Processors.post_process(analysis, file))
|
||||||
recompute_meta(image, file, &Image.process_changeset/2)
|
recompute_meta(image, file, &Image.process_changeset/2)
|
||||||
|
@ -53,8 +53,11 @@ defmodule Philomena.Images.Thumbnailer do
|
||||||
defp apply_thumbnail(image, thumb_dir, {:symlink_original, destination}),
|
defp apply_thumbnail(image, thumb_dir, {:symlink_original, destination}),
|
||||||
do: symlink(image_file(image), Path.join(thumb_dir, destination))
|
do: symlink(image_file(image), Path.join(thumb_dir, destination))
|
||||||
|
|
||||||
defp generate_dupe_reports(image),
|
defp generate_dupe_reports(image) do
|
||||||
do: DuplicateReports.generate_reports(image)
|
if not image.duplication_checked do
|
||||||
|
DuplicateReports.generate_reports(image)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
defp recompute_meta(image, file, changeset_fn) do
|
defp recompute_meta(image, file, changeset_fn) do
|
||||||
{:ok, %{dimensions: {width, height}}} = Analyzers.analyze(file)
|
{:ok, %{dimensions: {width, height}}} = Analyzers.analyze(file)
|
||||||
|
|
Loading…
Reference in a new issue