github优秀代码链接:https://github.com/deeplab-ai/atr-net
感觉这个项目有个很好的优点是内含有faster rcnn pytorch1.0 版本,我目前的faster rcnn 调通的是caffe 版本,python27
- python3 main.py --dataset=VG200 --task=predcls --model=atr_net
- python3 main.py --dataset=VG200 --task=objdet --model=object_detector
- python3 main.py --dataset=VG200 --task=sggen --model=atr_net
Steps 1 and 2 will train and step 3 is only for eval.
运行完第一个指令后的截图
运行完第二个指令中的截图
运行第三个指令后
但是这一句的后面运行好几次都是段错误,不知道什么情况,但是问了原作者,好像也没有具体说明,可能我没有描述好我的问题。所以目前不准备继续处理此问题。
https://github.com/deeplab-ai/atr-net/issues/5https://github.com/deeplab-ai/atr-net/issues/5
最后,附上一个连接
https://github.com/deeplab-ai/atr-net/issues/3https://github.com/deeplab-ai/atr-net/issues/3
【题外话】将字幕转换成场景图
利用https://github.com/vacancy/SceneGraphParser
其中需要设置sng_parser 为模块,可以在linux 下的.bashrc 中设置
在运行案例时,会出现,en 模块不识别的问题,应该修改spacy load语句为
spacy.load('de_core_web_sm') 即可
之后就可以正常运行案例
JAVA版本
The Stanford Natural Language Processing Group
按照网站说明下载下来,并将第二个jar 包放到第一个的目录下,然后进入第一个的目录下,运行下面代码
java -mx2g -cp "*" edu.stanford.nlp.scenegraph.RuleBasedParser
此处提示你要输入需要解析的句子
或者编写一个java 文件,然后用Java命令运行
参考http://www.qishunwang.net/news_show_39213.aspx 但是其中classpath有一处拼写错误,可以在classpath 后面紧紧添加stanford 的目录
import edu.stanford.nlp.scenegraph.RuleBasedParser;
import edu.stanford.nlp.scenegraph.SceneGraph;
public class HI
{
public static void main(String[] args)
{
String sentence = "A brown fox chases a white rabbit.";
RuleBasedParser parser = new RuleBasedParser();
SceneGraph sg = parser.parse(sentence);
//printing the scene graph in a readable format
System.out.println(sg.toReadableString());
//printing the scene graph in JSON form
// System.out.println(sg.toJSON());
}
}
想看一下Scenegraph 的类的内容
可以下载一个反编译软件
参考:Java反编译工具JD-GUI.exe_laijunfeng816的博客-CSDN博客_jd-gui.exe