Truly


  • Home

  • Archives

conda 和系统 python 路径问题

Posted on 2018-06-12 | In tech

conda装完,在~/.bashrc 里面加上它的路径,source完就会取代系统自己的python路径有时候会不方便,我找到了这篇博客,以后可以参考一下,以下为转发内容:

那么,如果在~/.bashrc中修改文件的话,即加入export PATH=”/home/myname/anaconda2/bin:$PATH”,则输入python命令就会直接出来Anaconda环境下的python,当然,用TensorFlow是好的,用caffe就。。。。。。。因此,用caffe的话,我就会把这行去掉,再重新source ~/.bashrc.

这样做是麻烦了一些,但是那怎么办呢?我就想在caffe下使用自带python,在tensorflow的时候使用Anaconda。

于是,学到了一个“技巧”,叫做别名声明alias。

具体用法:

1
2
alias py27="/usr/bin/python2.7" 
alias pyana="/home/myname/anaconda2/bin/python2.7" (我自己的,一定要精确到python的版本,不能只到文件夹)

这样在使用系统自带python的时候,只需要在命令行输入py27即可,用Anaconda,输入python或者pyana都可。

注意:

  1. ~/.bashrc的文件中,export PATH=”/home/myname/anaconda2/bin:$PATH”还是要加上的
  2. 上面两行在每次开机的时候都是要输入的,如果不想每次都输入,则要将这两行加入~/.bashrc的文件中
  3. 如果想取消别名声明,用unalias py27或者删除~/.bashrc中的PATH,并且重新source ~/.bashrc

388. Longest Absolute File Path

Posted on 2018-06-11 | In leetcode

从今天开始刷google leetcode tag,应该都是先从抄开始的吧,先求速度吧。还是那句话,难的不是如何开始,而是坚持吧。作息,情绪,运动,娱乐,压力的平衡和统一,还是不是很容易。

6月中旬小结

Posted on 2018-06-11 | In 日常

忽然来到了6月中,同学们陆陆续续都找到了工作,也是为他们高兴。调整了两周的作息,终于开始见效了,还有跟着改善的饮食结构和时不时的去游泳,自然,脑子也越来越清晰,不会像之前有due的时候,昏昏沉沉,瞎几把活。

自己现在主要有这几件事情,申博和找工作。现在是RA找到了,老师也愿意给sponsor,但是sponsor多久还是没有头,反正research就是继续推进。然后,工作也要开始找了,投起来,刷题,争取能去做ml research相关的岗,慢慢往这个方向靠。之后,申博。

总的来说,时间是这样子的,白天做research,晚上刷题,投简历,周末总结反思,看看论文。

就research而言,本来就是水磨工夫,需要从长计议,慢慢跟着师兄的schedule走就好了。论文的话,感觉这个阶段自己细看也看不懂,还是泛读吧,多看几篇,找找感觉,之后找师姐讨论一下。有大神指路还是会不一样的。

找工作,按公司tag刷吧,先找师兄内推,一波一波来吧。自己之前也刷了150多题了,基本类型也见过了。现在以google的tag为主,好好刷,过了在看别的公司的tag,应该会好点。

也许自己也不一定能兼顾吧,到时候在做取舍吧,但有些东西还是统一的。

加油~

Learning from Synthetic Data: Addressing Domain Shift for Semantic Segmentation

Posted on 2018-06-10 | In transfer learning

这篇论文主要是想利用合成的数据来解决迁移学习的问题。

abstract

Visual Domain Adaptation is a problem of immense importance in computer vision. Previous approaches showcase the inability of even deep neural networks to learn informative representations across domain shift. This problem is more severe for tasks where acquiring hand labeled data is extremely hard and tedious. In this work, we focus on adapting the representations learned by segmentation networks across synthetic and real domains. Contrary to previous approaches that use a simple adversarial objective or superpixel information to aid the process, we propose an approach based on Generative Adversarial Networks (GANs) that brings the embeddings closer in the learned feature space. To showcase the generality and scalability of our approach, we show that we can achieve state of the art results on two challenging scenarios of synthetic to real domain adaptation. Additional exploratory experiments show that our approach: (1) generalizes to unseen domains and (2) results in improved alignment of source and target distributions.

introduction

他们主要的工作也是解决,没有label的domain adaptation问题。和之前FCNs那篇将adversarial loss应用在feature space不同,他们将adversarial loss应用在image space,并是有discriminator导出的。此外,他们还用了生成模型将源域和目标域的分布在feature space里面对齐了。然后,他这里面提到了style space: 其他的很多工作做的是将源域的图做了一个image translation,换句话说就是实现实际的风格迁移,然后在train。

structure


然后结构里面G network和D network就是GAN了。

loss function

感觉对loss function的拆解和分析是理解相关approach的关键。下面我们逐个分析

克城

Posted on 2018-06-09 | In 日常

从匹兹堡开车两个小时,突然就来到克城,感受到一座城市的人对于一个人期待,他就是Lebron James,克城之子。

一路上都是穿着23号球衣的球迷,我们早早寻了车位,随着人流赶到传说中的速贷场馆。

然后是比赛现场,看到老詹进一个球,全场球迷甩毛巾,这种体验是以前看直播从未有过的。
虽然,最后骑士还是落败了,但是这个男人没有输。

当然,我是来我我库的,现场看球,能充分感受到他的速度,还有勇士快速的轮转。

也没有想象的惊心动魄,就是看完比赛,然后回家~

conda cheat sheet

Posted on 2018-06-08 | In tech

最近在使用anaconda,抄了一下cheat sheet:

Conda basics

statement command
Verify conda is installed, check version number conda info
Update conda to the current version conda update conda
Install a package included in Anaconda conda install PACKAGENAME
Run a package after install, example Spyder* spyder
Update any installed program conda update PACKAGENAME
Command line help COMMANDNAME –help conda install –help

Using environments

statement command
Create a new environment named py35, install Python 3.5 conda create –name py35 python=3.5
Activate the new environment to use it WINDOWS: activate py35
LINUX, macOS: source activate py35
Get a list of all my environments, active environment is shown with * conda env list
Make exact copy of an environment conda create –clone py35 –name py35-2
List all packages and versions installed in active environment conda list
List the history of each change to the current environment conda list –revisions
Restore environment to a previous revision conda install –revision 2
Save environment to a text file conda list –explicit > bio-env.txt
Delete an environment and everything in it conda env remove –name bio-env
Deactivate the current environment WINDOWS: deactivate
macOS, LINUX: source deactivate
Create environment from a text file conda env create – le bio-env.txt
Stack commands: create a new environment, name and install the biopython package conda create –name bio-env biopython it bio-env

Finding conda packages

statement command
Use conda to search for a package conda search PACKAGENAME
See list of all packages in Anaconda https://docs.anaconda.com/anaconda/packages/pkg-docs

如何读paper

Posted on 2018-06-07 | In machine learning

这个应该是一个老生常谈的话题了,对于我这种半路出家的人来说,如何高效的看paper其实对自己的发展也是挺重要的。
看了知乎上的一些讨论感觉也不错,如何读一篇优秀的计算机论文?

评论里面的Jobs Bill大大这点讲的就挺好:

研究一个问题不可能只读一篇paper,当时我的老师给了我几十篇论文(论文的质量算是有所保证了),我平时还要上课背单词哪有那么多时间读啊……于是我采取的方法是按时间顺序把所有论文的abstract和introduction先读了,记录一下研究的什么问题,记录一下研究背景的(人家研究这算法是有什么应用,这部分以后自己写论文也能用上)记录一下此paper做了什么贡献(如何比前人的好),此过程留意论文发表的级别就OK,我现在只读过理论计算机科学算法方面的paper,一般读到introduction就应该弄懂这篇paper和参考文献中的那一篇或几篇作比较,抓住论文重点比较的参考文献接着读(有点儿递归调用的意思吧)。读每一篇时,跳过Related Works,跳过算法的具体实现细节,跳过算法证明,跳过实验说明,直接扫一眼实验结果,记一下在哪些方面改进了。个人感觉这些对于第一遍来说已经足够。

我感觉第一遍看,把这篇论文要解决的问题大概理解就可以了,如果需要进一步看的话,看它引的论文的abstract和introduction,回头再看它的工作。嗯,目前就先这样子吧。

如果,像我(哈哈)论文的作者正好在同一个学校的话,自己看到一定程度,直接约交流应该也是可以的,近期想试试,哈哈哈。

Semantic-aware Grad-GAN for Virtual-to-Real Urban Scene Adaption

Posted on 2018-06-06 | In transfer learning

最近在做迁移学习,这篇是我们学校的大佬做的工作,看下总结一下:

abstract

Recent advances in vision tasks (e.g., segmentation) highly depend on the availability of large-scale real-world image annotations obtained by cumbersome human labors. Moreover, the perception performance often drops signif- icantly for new scenarios, due to the poor generalization capability of models trained on limited and biased annota- tions. In this work, we resort to transfer knowledge from automatically rendered scene annotations in virtual-world to facilitate real-world visual tasks. Although virtual-world annotations can be ideally diverse and unlimited, the dis- crepant data distributions between virtual and real-world make it challenging for knowledge transferring. We thus propose a novel Semantic-aware Grad-GAN (SG-GAN) to perform virtual-to-real domain adaption with the ability of retaining vital semantic information. Beyond the sim- ple holistic color/texture transformation achieved by prior works, SG-GAN successfully personalizes the appearance adaption for each semantic region in order to preserve their key characteristic for better recognition. It presents two main contributions to traditional GANs: 1) a soft gradient-sensitive objective for keeping semantic boundaries; 2) a semantic-aware discriminator for validating the fidelity of personalized adaptions with respect to each semantic region. Qualitative and quantitative experiments demonstrate the superiority of our SG-GAN in scene adaption over state- of-the-art GANs. Further evaluations on semantic seg- mentation on Cityscapes show using adapted virtual im- ages by SG-GAN dramatically improves segmentation per- formance than original virtual data.

related work

真是牛逼,总结的超级好:
Previous domain adaption approaches can be summarized as two lines: minimizing the difference between the source and target feature distributions [12, 15, 16, 17, 18, 36]; or explicitly ensuring that two data distributions close to each other by adversarial learning [24, 26, 27, 34, 42, 44] or feature combining [10, 11, 22, 25, 37].
Image-based adaptation can be also referred to as image-to-image translation, i.e., translating images from source domain to target domain, which can be summarized into two following directions.

the problem to solve

传统的GAN的问题是尽管可以实现从源域到目标域图片颜色和文理的迁移,但是会忽视关键区域的一些特征(这些特征和颜色文理有什么区别)。

whole picture

loss objective

下面对里面涉及的loss进行拆解

adversarial loss

首先这里是基于标准的对抗损失,这里我先重温一下GAN里面的基本loss function:
$min_G max_D V(D, G) | V(D, G) = E_{x~p_{data}(x)}[log D(x)] + E_{z_{p_{z}(z)}}[log(1 - D(G(z)))]$
Generative Adversarial Network 的基本思想,生成网络G想要使得V尽量小,而判别网络D想要使得V尽量大,然后二者一直在对抗。
这里有一张图很好的对此做了说明:

我们从real data的分布里面sample得到一个图,我们有一个fake的数据分布$z~p_z(z)$,经过我们的生成网络生成一张图,然后这两张图,分别传到判别网络里面判断,输出0或者1。

cycle consistency loss

如果看过我之前写的cycle-GAN的分析这个就很好理解了。作者也说了,他们也是基于cycle-GAN来改进的。

Soft gradient-sensitive objective

这个和edge detector有关。

找老师二三事

Posted on 2018-06-04 | In 日常

花了一个学期的时间,终于在暑假找到了一个老师。感觉找老师的难度和你距离他目前带的学生的水平的差距有关。越好的导师,需要越强的学生。感觉cs的老师特别难找,你没有论文,没有比较充分的经验的话,就算是unpaid的他们也不会要你。所以最后自己去了本系找了一个老师。这只是对于我而言,一个要用opt的老学长。但是一般的操作是这样子的,先上target老师的课,然后第二学期或者暑假,去找那个老师,争取到能去他/她那里做summer intern,或者学期间跟他/她做项目,抵学分。之后,就会顺很多,然后你要清楚你的目标是什么,如果是发文章要推荐信的话,你就要算好你target会议的时间去弄了。还有一个建议是,对于你选课project,你争取上有一个自己的core project(也许是你要发文章的那个),然后你上所有相关课的project都围绕这个来做,把上课和你发文章统筹起来。我见过一个做CV的台湾师兄是在701课上做他core project的一个sub project,感觉也挺有意思的。所以,早点搞起来吧。

为什么坚持

Posted on 2018-06-04 | In 日常

也许还是数学,做研究可以在去碰数学,也许就是这么简单,我相信世间真理是简单的,我深信数学的力量,
我还是想坚持,也许statistic machine learning是我目前所找寻的答案吧。所有的经历,所有的印记,都深深的烙印在自己的心田。我只想用数学拨开这个领域的外衣,看到里面的美吧。看到田渊栋说,虽然做应用,但骨子里还是做数学证明,哈哈哈,也许就是这样子吧,我才会坚持下来。

1…131415…17

Chu Lin

去人迹罕至的地方,留下自己的足迹。

166 posts
17 categories
94 tags
© 2022 Chu Lin
Powered by Hexo
|
Theme — NexT.Muse v5.1.4