Skip to content

Commit

Permalink
Revert "implement retina AI for face recognition" and related commits:
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuukiy committed Aug 17, 2024
1 parent 0dd51f7 commit 279ee7b
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 39 deletions.
10 changes: 1 addition & 9 deletions JavSP.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@


from core.print import TqdmOut
from core.baidu_aip import aip_crop_poster


# 将StreamHandler的stream修改为TqdmOut,以与Tqdm协同工作
Expand Down Expand Up @@ -439,21 +440,12 @@ def reviewMovieID(all_movies, root):
def crop_poster_wrapper(fanart_file, poster_file, method='normal', hard_sub=False):
"""包装各种海报裁剪方法,提供统一的调用"""
if method == 'baidu':
from core.ai_crop.baidu_aip import aip_crop_poster
try:
aip_crop_poster(fanart_file, poster_file)
except Exception as e:
logger.debug('人脸识别失败,回退到常规裁剪方法')
logger.debug(e, exc_info=True)
crop_poster(fanart_file, poster_file)
elif method == 'retina':
from core.ai_crop.retina import ai_crop_poster
try:
ai_crop_poster(fanart_file, poster_file)
except Exception as e:
logger.debug('人脸识别失败,回退到常规裁剪方法')
logger.debug(e, exc_info=True)
crop_poster(fanart_file, poster_file)
else:
crop_poster(fanart_file, poster_file)
if cfg.Picture.add_label_to_cover:
Expand Down
25 changes: 0 additions & 25 deletions core/ai_crop/retina.py

This file was deleted.

File renamed without changes.
1 change: 0 additions & 1 deletion core/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ use_ai_crop = no
# 要使用图像识别来裁剪的番号系列($label), \d表示纯数字番号(FC2和识别到的无码影片会自动使用图像识别裁剪)
use_ai_crop_labels = \d,ARA,SIRO,GANA,MIUM
# 要使用的图像识别引擎,详细配置见文档 https://github.com/Yuukiy/JavSP/wiki/AI-%7C-%E4%BA%BA%E8%84%B8%E8%AF%86%E5%88%AB
# Can be either 'baidu' or 'retina'
ai_engine =
# 百度人体分析应用的AppID(仅在图像识别引擎为baidu时需要)
aip_appid =
Expand Down
2 changes: 0 additions & 2 deletions core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,6 @@ def validate_ai_config(cfg: Config):
empty_keys = [i for i in required_keys if not piccfg[i]]
if empty_keys:
logger.error('使用百度人体分析时,相关设置不能为空: ' + ', '.join(empty_keys))
elif piccfg.ai_engine.lower() == 'retina':
piccfg.ai_engine = 'retina'
else:
logger.error('不支持的图像识别引擎: ' + piccfg.ai_engine)

Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ tqdm==4.59.0
urllib3==1.25.11
pywin32==303
pywin32-ctypes==0.2.0
retina-face==0.0.14
keras==2.15.0
cryptography==42.0.4

0 comments on commit 279ee7b

Please sign in to comment.