1 Star 2 Fork 0

吴起乐/ManTra-Net-pytorch

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.py 1.28 KB
一键复制 编辑 原始数据 按行查看 历史
吴起乐 提交于 2年前 . wql
import os
from MantraNet.mantranet import pre_trained_model, check_forgery
from BusterNet.BusterNetCore import create_BusterNet_testing_model, simple_cmfd_decoder, visualize_result
import streamlit as st
import cv2
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
st.header("Image Manipulation Detection Demo")
@st.cache()
def check_image(img_path):
device = "cpu" # to change if you have a GPU with at least 12Go RAM (it will save you a lot of time !)
MantraNetmodel = pre_trained_model(
weight_path="MantraNet/MantraNetv4.pt", device=device
)
fig = check_forgery(MantraNetmodel, img_path=img_path, device=device)
busterNetModel = create_BusterNet_testing_model( 'BusterNet/pretrained_busterNet.hd5' )
rgb = cv2.imread(img_path)
pred = simple_cmfd_decoder( busterNetModel, rgb )
figure = visualize_result( rgb, pred, pred, figsize=(20,20), title='BusterNet CMFD')
return fig, figure
uploaded_image = st.file_uploader("Upload your image", type=["jpg", "png"])
if uploaded_image is not None:
with open(os.path.join("images", uploaded_image.name), "wb") as f:
f.write(uploaded_image.read())
fig, figure = check_image(os.path.join("images", uploaded_image.name))
st.write("ManTraNet")
st.pyplot(fig)
st.write("BusterNet")
st.pyplot(figure)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wu_qile/ManTra-net-pytorch.git
git@gitee.com:wu_qile/ManTra-net-pytorch.git
wu_qile
ManTra-net-pytorch
ManTra-Net-pytorch
master

搜索帮助