ductai199x commited on
Commit
97c540b
·
verified ·
1 Parent(s): a67fae8

Update modeling_fsg.py

Browse files
Files changed (1) hide show
  1. modeling_fsg.py +0 -31
modeling_fsg.py CHANGED
@@ -351,37 +351,6 @@ class FsgModel(
351
  https://ieeexplore.ieee.org/abstract/document/9113265
352
 
353
  This class is designed to create a graph-based representation of forensic similarity between different patches of an image, allowing for the detection of manipulated regions.
354
-
355
- Args:
356
- stride_ratio (float): The ratio of the stride to the patch size, determining the overlap between patches. The lower the value, the higher the overlap.
357
- fast_sim_mode (bool): If True, the algorithm uses a faster method to compute similarity scores, potentially at the cost of accuracy.
358
- loc_threshold (float): The threshold for determining the location of interest in the similarity graph. Values above this threshold are considered significant.
359
- is_high_sim (bool): If True, higher similarity scores indicate higher similarity. If False, lower scores indicate higher similarity.
360
- need_input_255 (bool): If True, input images are expected to be scaled to [0, 255]. If False, images are expected to be in [0, 1].
361
- **kwargs: Additional keyword arguments passed to the superclass initializer.
362
-
363
- Example Usage:
364
- ```python
365
- import torch
366
- import matplotlib.pyplot as plt
367
- from torchvision.io import read_image, ImageReadMode
368
- from model import FSG
369
-
370
- ckpt_path = "path/to/ckpt.pth"
371
- model = FSG.load_from_checkpoint(ckpt_path, map_location="cpu", stride_ratio=0.5, fast_sim_mode=False, loc_threshold=0.37, is_high_sim=False, need_input_255=False)
372
- model.eval()
373
-
374
- img_path = "path/to/image.jpg"
375
- image = read_image(img_path, mode=ImageReadMode.RGB).float() / 255
376
-
377
- device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
378
- with torch.no_grad():
379
- img_preds, loc_preds = model(image[None, ...].to(device))
380
-
381
- plt.imshow(loc_preds.cpu()[0])
382
- plt.colorbar()
383
- plt.show()
384
- ```
385
  """
386
  config_class = FsgConfig
387
 
 
351
  https://ieeexplore.ieee.org/abstract/document/9113265
352
 
353
  This class is designed to create a graph-based representation of forensic similarity between different patches of an image, allowing for the detection of manipulated regions.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  """
355
  config_class = FsgConfig
356