• 2012-11-10 19:18:00

    Apache Buildr是类似Ruby Rake的Build System。 和我之前学习的Groovy Gradle很像。



    这次先介绍如何安装buildr. 我之前已经有在自己的机器上安装过JRuby,所以这次就直接用JRuby来安装。


    jruby –S gem install buildr 即可。


    可通过运行 buildr --verion来验证是否安装成功。

    Ruby和JRuby分别维护者不同的Gem Repository,所以你也可以以Ruby的方式下去安装,这里就不多述了。


  • Build EARBEAR)熊是一种工具,可生成用于clang工具的编译数据库。 在clang项目中使用JSON编译数据库来提供有关如何处理单个编译单元的信息。 机智构建EARBEARBear是一种工具,可为clang工具生成编译数据库。 ...
  • ʔ·ᴥ·ʔ建立EAR Bear是一种工具,可生成用于clang工具的编译数据库。 在clang项目中使用来提供有关如何处理单个编译单元的信息。 这样,很容易用替代程序重新运行编译。 获取编译数据库的一种方法是使用cmake...
  • bear插件报错 ld.so: object '/usr/${LIB}/bear/libear.so' from LD_PRELOAD bear -h usage: bear [-h] [--version] [--verbose] [--cdb <file>] [--use-cc <path>] [--use-c++ <path>] [--...



    ld.so: object '/usr/${LIB}/bear/libear.so' from LD_PRELOAD 

    bear -h

    usage: bear [-h] [--version] [--verbose] [--cdb <file>] [--use-cc <path>]
                [--use-c++ <path>] [--append] [--libear LIBEAR]

    positional arguments:
      build                 Command to run.

    optional arguments:
      -h, --help            show this help message and exit
      --version             show program's version number and exit
      --verbose, -v         Enable verbose output from 'bear'. A second, third and
                            fourth flags increases verbosity. (default: 0)
      --cdb <file>, -o <file>
                            The JSON compilation database. (default:
      --use-cc <path>       Hint 'bear' to classify the given program name as C
                            compiler. (default: cc)
      --use-c++ <path>      Hint 'bear' to classify the given program name as C++
                            compiler. (default: c++)

    advanced options:
      --append, -a          Extend existing compilation database with new entries.
                            Duplicate entries are detected and not present in the
                            final output. The output is not continuously updated,
                            it's done when the build command finished. (default:
      --libear LIBEAR, -l LIBEAR
                            specify libear file location. (default:



    find /usr/ -name "*bear*"


     bear -l /usr/lib/x86_64-linux-gnu/bear/libear.so make -j4

  • frr-devtools 用于FRR的开发工具,脚本,配置文件等 目录清单 Bear-Build EAR的子模块,用于生成编译数据库 cocci-Coccinelle语义补丁 消毒-与ASAN / MSAN / TSAN相关的内容 脚本-安装脚本,重构脚本等
  • 目录 How to Build the Confidence Habit Make friends with your failings and limitations Don’t be pushy or aggressive Don’t be defensive Do what you believe to be right ...



    How to Build the Confidence Habit

    Make friends with your failings and limitations

    Don’t be pushy or aggressive

    Don’t be defensive

    Do what you believe to be right

    Set challenging goals

    Keep a record of your achievements

    Learn to be optimistic

    Take a balanced approach


    7 Ways To Start To Value Yourself

    1. Stop comparing yourself

    2. Don’t settle

    3. Start appreciating

    4. Foster healthy relationships

    5. Learn to say No

    6. Set healthy boundaries

    7. Follow your heart

    Becoming More Me Through Meditation

    My anxiety is manageable, not curable.

    Time for Self-Care is not Selfish.

    Meditation Makes Difficult Moments Less Difficult

    The Skeptic Became the Sales Pitch

    I Am Not Afraid of Me


    How to Build the Confidence Habit



    build confidence

    “If you hear a voice within you say “you cannot paint,” then by all means paint, and that voice will be silenced.”  – Vincent Van Gogh

    We are all beset with doubts sometimes. Even the most self-assured and successful people can be unsure of themselves. Some people are clearly more confident than others, though. To what extent this is ‘nature’ and ‘nurture’ is unclear, though I suspect that ‘nurture’ has a lot to do with it. I’ve seen my own confidence wax and wane over the years, and external factors have certainly played a part. Some signs that you might be lacking somewhat in confidence are:

    • Thinking that other people are better than you
    • Expecting the worst outcome
    • Engaging in negative self-talk
    • Feeling the need to justify your behavior to others
    • Overreacting to criticism
    • Not having many friends or avoiding social situations
    • Body language that is defensive and closed.

    If you have some of these traits, perhaps you need to consider building more confidence. Can this be done? I think it’s clear is that confidence, like most other traits, can be developed. Like a muscle, with training and in time, it can become strong and powerful. To put it another way:confidence is a habit – confidence begets confidence. Here are some training ideas to develop this most important of habits.

    Make friends with your failings and limitations

    This is a key area. Obviously, you are not perfect – far from it. So long as you are challenging yourself, stepping out of your comfort zone and seeking to develop, you will be making mistakes. The mistakes are signs of growth and nothing to be ashamed of.. Confident people are comfortable in their own skin, happy with themselves in all their imperfection. They have nothing to prove.

    Don’t be pushy or aggressive

    Confidence can manifest itself in many different ways, and sometimes there is a visibly assertive quality to it, but there is also a quieter and more restrained confidence. When you meet a confident person, you tend to pick up that the person is happy with himself and feelscomfortable in her own skin. Confidence does not mean aggressive, pushy, loud or superior, which is often a sign of over-compensation for some kind of inferiority complex.

    Don’t be defensive

    Listening to and acting on criticism is an important part of being confident. It is often very hard for us to be objective about ourselves, and other people can give us great insights into our strengths and weaknesses. Of course, we have to be critical about the things that people tell us, not falling into credulity and taking everything they say at face value. But the insights afforded by others can be very valuable. If people laugh at you or attack you, this probably says more about them than about you. Insecure people often try to cover up their feelings of inadequacy by falling into such behaviors.

    Do what you believe to be right

    Confident people tend to rely on an internal guidance system to keep them going along the right track, whereas those with less confidence can be buffeted around by other people’s opinions and agendas. Having an inner compass is an essential part of living assertively and confidently, and following the compass can sometimes mean having to take risks. But without risk, there is no growth.

    Set challenging goals

    Confident people tend to live in a more conscious and deliberate way, setting goals for themselves. They are secure enough to tolerate failure, and are comfortable with not getting things right first time. If we are not growing, then we are falling back – there is always movement. As we challenge ourselves, our comfort zone grows, and this growth often involves the pain of failure. This pain is too much for insecure people to bear. But to confident people, failure is only a stepping-stone, not the destination. Success, for confident people, is inevitable. It’s only a matter of time.

    Keep a record of your achievements

    It is common for people with limited self-confidence to compare themselves unfavorably with others. Such people may assume that others are ‘better’ and have achieved more, so it can be very helpful to make a list of achievements. If you do this, you may find that the list is longer than you thought. Imagine what you would think if this were a list of someone else’s achievements. Would you be impressed? Would you think highly of that person?

    Learn to be optimistic

    People who lack self-confidence are often pessimistic about the future and tend to think the worst. It’s important to replace negative, self-defeating mental chatter with upbeat, positive self-talk. All day long, thoughts are swirling around inside our head and we need to be conscious about this. Such self awareness isn’t easy, but with some gentle persistence you can become more aware of your thoughts and, when you catch yourself thinking in a negative way, replace the thought with something more positive. Examples of negative thinking are: exaggerating the negative aspects of things, taking things personally, feeling you are being blamed for things or feeling like a victim, to name just a few. Simply being aware of negative thinking modalities can be a great help in overcoming them. When you catch yourself thinking in such negative ways, try to replace the thought with something more self-affirming.

    Take a balanced approach

    The benefits of confidence are clear but, as with most things, too much of it can be unhealthy. Over-confidence, which can lead to errors of judgment and under-performance, is dangerous and should be guarded against. Confidence is about getting the balance right.


    Confident people are more relaxed, happier and enjoy situations, however challenging, a lot more than those with low self-esteem, trusting that they can deal with whatever problems and challenges might arise. If you fail, if you get it all wrong, it won’t be the end of the world. If you’re tense and worried about how you’re being perceived, your energy is being wasted – it’s not going into the matter at hand. So let go, take the focus of attention off yourself, relax and enjoy the ride.

    “Without a humble but reasonable confidence in your own powers you cannot be successful or happy.”  ~ Norman Vincent Peale

    The benefits of being confident are clear: you’ll be happier, more relaxed and probably healthier. You’ll use time more effectively because you won’t be worrying endlessly about other people’s opinions, and you’ll have a clearer sense of purpose, so you’ll be a lot more effective. Confidence, in a sense, is the key to happiness and fulfillment.

    “What a fool am I, thus to lie in a stinking dungeon, when I may as well walk at liberty!  I have a key in my bosom, called Promise, that will, I am persuaded, open any lock in Doubting Castle.” – John Bunyan

    Photo by Andy C


    7 Ways To Start To Value Yourself

    by Ulenda Myburgh | 17 comments

    value yourself

    “You can search throughout the entire universe for someone who is more deserving of your love and affection than you are yourself, and that person is not to be found anywhere. You, yourself, as much as anybody in the universe, deserve your love and affection” – Buddha

    One of the biggest myths we feed into is that setting ourselves as a number one priority is selfish and unkind. Truth is, it is the most loving thing we can do for ourselves and for others. Our loved ones gain when we are in a good space and when we have all our energy at any given moment. People benefit when we are whole and life opens when we are thriving. Yet, we’re so conditioned to believe that things will fall apart and it is not ethical to put the person who lives inside your heart, body, and mind first.

    I remember before I met my husband, I started to pull back from some toxic relationships in my life. I allowed myself to be taken advantage of; let myself be taken for granted. They demanded so much but gave so little. My time, my finances, my heartfelt, “I will stretch until I break, as long as you don’t have discomfort.”

    When my priorities shifted and I started giving a little more love to me. Not only did it feel amazing, but I had to have this love within me before I could give it freely to someone else. My new found happiness was poorly wished upon. And instead of attempting to fix those relationships, I stood my ground with “I am loveable and worthy” mantras. I focused on the blossoming relationships and let go of the suffocating.

    Making yourself a priority enables you to be a better person, not just for yourself, but for the relationships your forge along the way. The choices we make from a more loving space are far more beneficial than the ones we make from a place of guilt, lack and overextending.

    Below are seven ways to start to value yourself and make yourself an important person in your life. Besides, everything starts with you.

    1. Stop comparing yourself

    Comparing ourselves to others is a losing battle. Not only do we look for things we lack, but we find ourselves in the feeling of lack. Unless you have been in their shoes, view life the way they do and gone through their experiences, you are comparing yourself to information that can in no way be accurate. Comparing takes the focus off you and onto that person, yet your power lies in things you can affect in your life. You are a unique being and there is nobody in the world like you.

    Start to shift your focus on things that are going right in your life and pay attention to the person looking back in the mirror. He or she has their own unique attributes. Let go of the inner perfectionist and start to appreciate your smile, your talents, what you have to offer. Starting to see your value is the fastest way to shift focus to the right place.

    2. Don’t settle

    Some people stay in jobs they don’t like just because of the salary. Others settle in relationships that no longer cause their hearts to race. Some of us stay with friends who deplete us because we long for any kind of company. Whatever your settle, it’s not worth the cost. You deserve peace of mind and to be outrageously happy.

    If you are constantly saying to yourself, “There has to be something better than this”, you are probably settling. Don’t settle for less. Seek out to find your best.

    3. Start appreciating

    Appreciate the bed you sleep it. Appreciate your significant other. Appreciate the clothes you have on your back, your car, your food. But mostly, don’t forget to appreciate what you bring into the world. Start to see the joy you bring to others. Give thought to the impact of that joy and its ripple effects. Just because you are not aware, does not mean it has not extended itself further than you can imagine.

    The more you appreciate, the more good will flow into your life.

    4. Foster healthy relationships

    Let go of or at least distance yourself from anything that causes you to feel less than good. Find yourself in the presence of people who bring something significant into your life. Make it a point to have at least two people who feed your spirit, encourage your dreams and accept you for who you are. No alterations. Cultivating strong, nurturing bonds encourages us to remember we are not alone and keeps our hearts open.

    5. Learn to say No

    While we are here to help one another there will be times we’re tempted to do things at the expense of our own well-being. Sometimes when we give more than we can we don’t allow the other person to learn from or have their own experiences. Continually doing things out of insincere obligation can lead to resentment. Instead, honor yourself by doing what feels right for you.

    ‘No’ can be liberating, because when we say no to others we are saying “yes” to ourselves and we’re in alignment with our values. Allow yourself to say no once in a while. This practice will improve your self-esteem and create a space for people to value and respect you more.

    6. Set healthy boundaries

    Having clear boundaries is vital to establishing that relationships are mutually respectful. Believe it or not, but putting “up” boundaries actually creates freedom because when our wishes are clearly defined, there is no need to put up walls. Boundaries reflect our self-esteem and our values. A healthy self-respect will teach others how to treat you.

    And when the occasional person attempts to push against your lines, simply keep your feet placed firmly on the ground.

    7. Follow your heart

    We all have something that makes us come alive and gives our lives meaning. Don’t forget to listen to the part of you that drives your bliss, and be aware of your idol wants and those little things that distract you. Focus on your purpose because dreams never really go away. They simply get postponed.

    Our passions can be as little or big as they are, and we can have one or a multitude of them. Listen to the things that are ticking at your heart’s door and find a way to do one thing at a time if you can. You can encourage yourself to do it all and to find a way for life to support you while you do.

    Everything in our lives starts with us and ripples into our relationships. So it only makes sense to give yourself as much love, nurturing and joy that you would look for in others, or that others would seek in you. By living the best life we can we inject these ripples to go out with love, beauty, and kindness.


    Becoming More Me Through Meditation

    by Amy Williams | 11 comments

    becoming me meditation

    “The thing about meditation is: You become more and more you.” — David Lynch

    The thing about my meditation experience is this:  I was terrified of what it meant to become more me.  When I agreed at the urging of a very patient therapist to at least attempt to meditate, I was truly afraid of what was underneath the layers of self-preservation I had built up.  It was my thirty-fifth birthday and my gift to myself was to commit to anything that might improve my anxiety.

    Up to that point, I had tried reading self-help books, running, yoga, and even prescription medication.  Like clockwork, though, I could expect an anxiety attack around 2:30PM and again around 8:00PM, times when my mind became less engaged in work and productive thoughts.  Scrambling, circular thoughts precipitated the inability to take a deep breath and the combination led to reaching out like a person drowning for any validation I could find from friends and family.

    Anxiety had been a part of my life since childhood, but as I watched my thirty-fifth birthday approach, I decided that I was otherwise happy enough and managing my anxiety was the only thing I would change.

    Before my first therapy appointment, I committed to trying anything she suggested.  “How often do you meditate?” was the first question she asked.

    “I don’t”  I replied, and she made a note, and advised that I would learn.

    I committed to meditating for at least five minutes every day.  At the end of my run in the evenings, I walked down to a pond in my neighborhood with nothing more than my cell phone and a pair of ear buds and sat staring at the water listening to a guided meditation and fighting skepticism.

    Not every day’s meditation went well.  Some days I was able to reach an easy Zen-like state quickly and stay there.  Some days I sat and worried that neighbors would think I was some sort of hippy if I stared at the water too long.  Somehow, though, five minutes became ten, then fifteen.  A daily meditation practice became a twice-daily meditation.

    There’s plenty of room for improvement and I’m excited to learn more about meditation, and for the first time, I’m excited to learn more about myself.  After six weeks, I’m startled at the changes meditation has had in my life.

    My anxiety is manageable, not curable.

    Anxiety will always be a part of me, but it doesn’t have to define me.  After only six weeks of regular practice, my anxiety attacks are noticeably dwindling.  I’m learning to breathe through those moments when troubled thoughts do arise, and some days I look at the clock and realize an entire day has passed without one anxiety attack.  I’m not naïve enough to think I’m cured—I don’t believe anxiety has a cure.  I am optimistic to think I’ve learned a natural, holistic way to manage anxiety.

    I’m still in the honeymoon-phase of meditation, but I can already sense that it has to be a daily practice and not just something I can turn to when I need it.  I can feel myself start to slip when I don’t practice with an intention.

    Time for Self-Care is not Selfish.

    I could have made time for a party I was invited to on a Saturday night, but there was something feeling just a little off.  I knew I would be better served by spending some time in solitude and making more time to meditate.  I declined the invitation and stayed home, knowing instinctively that I had made the right decision for me, but I had to fight through habitual feelings of guilt.  That’s a habit I’m trying to break, and given how much better I felt the next day, I know I made the right decision.  It’s not a selfish act to spend time in solitude and to practice self-care.

    Meditation Makes Difficult Moments Less Difficult

    My doctor was pleasantly surprised to find my blood pressure had significantly improved after six weeks of changing nothing more than adding a twice daily meditation practice.  I was pleasantly surprised to find that my relationships, my running regimen, and my career also suddenly felt far less challenging and stressful.

    My anxiety was no longer allowed to make decisions either in my relationships or in my career, and subsequently, my stress reduced and my productivity increased.  Challenging moments passed without creating an anxiety attack, and I began to operate from a centered place of authenticity instead of responding to every whim of my anxiety.

    Anxiety had been making decisions for far too long.  I had allowed anxiety to do so because it was easier, I thought, than scraping away the layers of self-doubt and insecurity to do what was right for me.  With anxiety lulled into a safe place through meditation, I am making more secure, more confident, and acting on my own behalf.

    The Skeptic Became the Sales Pitch

    “You should meditate,” I hear myself saying on a daily basis.  “Yes, you can, everyone can meditate!”  Who is this person?  Six weeks ago, I was the one trying to convince a therapist that I couldn’t meditate.  Now no one is immune from my sales pitch for meditation.  If coworkers complain to me that they can’t get enough sleep, I urge them to meditate.  A friend in crisis wants to vent in a telephone call, and I urge her to meditate.  I know that by now they’ve seen the change in me and I’m so desperate for others to take the fifteen-minute mental break that will help them that I am a broken record urging all who cross my path to breathe deep and let it go.

    I Am Not Afraid of Me

    I’ve come to the realization that my anxiety is rooted in the resistance I have built to feeling my feelings.  At the first sign of circular thinking and shortness of breath now, I zone in on how I’m feeling and why I’m feeling that emotion.  I don’t run.  I don’t put up a wall.  I let it pass over me, I acknowledge the feeling and if I can change it, I do.  If I can’t change the circumstances of the emotion, I let myself feel it.

    I was terrified of meditation when I started because I didn’t want to know what was under the protective layers of emotional scar tissue I had created to avoid feeling unpleasant emotions.  There are still difficult days when I realize that there’s an ugly bruise of emotion that I failed to properly address when it was happening.  But I’m not afraid.  This is me.  I am a collaboration of every memory, moment and emotion that has already happened.  I’m not yet quite fearless, but I am no longer afraid to sit with myself, allow an emotion, and dive into the messy, wondrous beauty of my own mind.

    This is my journey at six weeks.  Where are you in your journey and what unexpected epiphanies await?

  • PyTorch:生态简介

    千次阅读 2022-03-24 12:48:27
    'toaster', 'sink', 'refrigerator', 'N/A', 'book','clock', 'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush'] COCO_PERSON_KEYPOINT_NAMES =['nose','left_eye','right_eye','left_ear','right_ear...


    PyTorch的强大并不仅局限于自身的易用性,更在于开源社区围绕PyTorch所产生的一系列工具包(一般是Python package)和程序,这些优秀的工具包极大地方便了PyTorch在特定领域的使用。



    对于图卷积网络,有PyTorch Geometric等。






    图像 torchvision



    • 了解torchvision
    • 了解torchvision的作用


    " The torchvision package consists of popular datasets, model architectures, and common image transformations for computer vision. "


    • torchvision.datasets *
    • torchvision.models *
    • torchvision.tramsforms *
    • torchvision.ops
    • torchvision.utils





    • Caltech101
    • Caltech256
    • CelebA
    • CIFAR10
    • CIFAR100
    • Country211
    • DTD
    • EMNIST
    • EuroSAT
    • FakeData
    • FashionMNIST
    • FER2013
    • FGVCAircraft
    • Flickr8k
    • Flickr30k
    • Flowers102
    • Food101
    • GTSRB
    • INaturalist
    • ImageNet
    • KMNIST
    • LFWPeople
    • LSUN
    • MNIST
    • Omniglot
    • OxfordIIITPet
    • Places365
    • PCAM
    • QMNIST
    • RenderedSST2
    • SBU
    • StanfordCars
    • STL10
    • SUN397
    • SVHN
    • USPS


    • CocoDetection
    • CelebA
    • Cityscapes
    • GTSRB
    • Kitti
    • OxfordIIITPet
    • SBDataset
    • VOCSegmentation
    • VOCDetection
    • WIDERFace


    • FlyingChairs
    • FlyingThings3D
    • HD1K
    • KittiFlow
    • Sintel


    • LFWPairs
    • PhotoTour


    • CocoCaptions


    • HMDB51
    • Kinetics
    • Kinetics400
    • UCF101





    from torchvision import transforms
    image_size = (224, 224)
    data_transform = transforms.Compose([
        transforms.ToPILImage(),   # 这一步取决于后续的数据读取方式,如果使用内置数据集则不需要




    可以https://github.com/pytorch/vision/tree/main/torchvision/models这里进行查看现在有哪些预训练模型,下面将对如何使用这些模型进行详细介绍。 此处以torchvision0.10.0 为例,如果希望获取更多的预训练模型,可以使用使用pretrained-models.pytorch仓库。




    • AlexNet
    • VGG
    • ResNet
    • SqueezeNet
    • DenseNet
    • Inception v3
    • GoogLeNet
    • ShuffleNet v2
    • MobileNetV2
    • MobileNetV3
    • ResNeXt
    • Wide ResNet
    • MNASNet
    • EfficientNet
    • RegNet
    • VisionTransformer
    • ConvNeXt




    语义分割的预训练模型是在COCO train2017的子集上进行训练的,提供了20个类别,包括
    background, aeroplane, bicycle, bird, boat, bottle, bus, car, cat, chair, cow, diningtable, dog, horse, motorbike, person, pottedplant, sheep, sofa,train, tvmonitor


    • FCN ResNet50, ResNet101
    • DeepLabV3 ResNet50, ResNet101, MobileNetV3-Large
    • LR-ASPP MobileNetV3-Large

    具体我们可以点击https://pytorch.org/vision/stable/models.html#semantic-segmentation进行查看预训练的模型的mean IOU和 global pixelwise acc


    物体检测,实例分割和人体关键点检测的模型同样是在COCO train2017进行训练的,在下方提供了实例分割的类别和人体关键点检测类别:

        '__background__', 'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus','train', 'truck', 'boat', 'traffic light', 'fire hydrant', 'N/A', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 'N/A', 'backpack', 'umbrella', 'N/A', 'N/A','handbag', 'tie', 'suitcase', 'frisbee', 'skis', 'snowboard', 'sports ball','kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard', 'tennis racket','bottle', 'N/A', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl','banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza','donut', 'cake', 'chair', 'couch', 'potted plant', 'bed', 'N/A', 'dining table','N/A', 'N/A', 'toilet', 'N/A', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone','microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'N/A', 'book','clock', 'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush']
    COCO_PERSON_KEYPOINT_NAMES =['nose','left_eye','right_eye','left_ear','right_ear','left_shoulder','right_shoulder','left_elbow','right_elbow','left_wrist','right_wrist','left_hip','right_hip','left_knee','right_knee','left_ankle','right_ankle']


    • Faster R-CNN
    • FCOS
    • Mask R-CNN
    • RetinaNet
    • SSD
    • SSDlite

    同样的,可以点击https://github.com/datawhalechina/thorough-pytorch/blob/main/%E7%AC%AC%E5%85%AB%E7%AB%A0%20PyTorch%E7%94%9F%E6%80%81%E7%AE%80%E4%BB%8B/8.2%20%E5%9B%BE%E5%83%8F%20-%20torchvision.md查看这些模型在COCO train 2017上的box AP,keypoint AP,mask AP


    torchvision.io提供了视频、图片和文件的 IO 操作的功能,它们包括读取、写入、编解码处理操作。



    • 不同版本之间,torchvision.io有着较大变化,因此在使用时,需要查看下torchvision版本是否存在想使用的方法
    • 除了read_video()等方法,torchvision.io提供了一个细粒度的视频API torchvision.io.VideoReader() ,它具有更高的效率并且更加接近底层处理。在使用时,需要先安装ffmpeg, 然后从源码重新编译torchvision才能使用这些方法
    • 在使用Video相关API时,最好提前安装好PyAV这个库


    torchvision.ops 提供了许多计算机视觉的特定操作

    包括但不仅限于NMSRoIAlign(MASK R-CNN中应用的一种方法),RoIPool(Fast R-CNN中用到的一种方法)。




    torchvision.utils 提供了一些可视化的方法,可以将若干张图片拼接在一起、可视化检测和分割的效果。






    • 计算资源耗费更多,并且没有高质量的model zoo,不能像图片一样进行迁移学习和论文复现
    • 数据集处理较麻烦,但没有一个很好的视频处理工具
    • 随着多模态越来越流行,亟需一个工具来处理其他模态


    PyTorchVideo 是一个专注于视频理解工作的深度学习库。PytorchVideo 提供了加速视频理解研究所需的可重用、模块化和高效的组件。PyTorchVideo 是使用PyTorch开发的,支持不同的深度学习视频组件,如视频模型、视频数据集和视频特定转换。


    PytorchVideo 提供了加速视频理解研究所需的模块化和高效的API。它还支持不同的深度学习视频组件,如视频模型、视频数据集和视频特定转换,最重要的是,PytorchVideo也提供了model zoo,使得人们可以使用各种先进的预训练视频模型及其评判基准。PyTorchVideo主要亮点如下:

    • 基于 PyTorch: 使用 PyTorch 构建。使所有 PyTorch 生态系统组件的使用变得容易
    • Model Zoo: PyTorchVideo提供了包含I3D、R(2+1)D、SlowFast、X3D、MViT等SOTA模型的高质量model zoo(目前还在快速扩充中,未来会有更多SOTA model),并且PyTorchVideo的model zoo调用与PyTorch Hub做了整合,大大简化模型调用
    • 数据预处理和常见数据:,PyTorchVideo支持Kinetics-400, Something-Something V2, Charades, Ava (v2.2), Epic Kitchen, HMDB51, UCF101, Domsev等主流数据集和相应的数据预处理,同时还支持randaug, augmix等数据增强trick
    • 模块化设计: PyTorchVideo的设计类似于torchvision,也是提供许多模块方便用户调用修改,在PyTorchVideo中具体来说包括data, transforms, layer, model, accelerator等模块,方便用户进行调用和读取
    • 支持多模态: PyTorchVideo现在对多模态的支持包括了visual和audio,未来会支持更多模态,为多模态模型的发展提供支持
    • 移动端部署优化: PyTorchVideo支持针对移动端模型的部署优化(使用前述的PyTorchVideo/accelerator模块),模型经过PyTorchVideo优化了最高达7倍的提速,并实现了第一个能实时跑在手机端的X3D模型(实验中可以实时跑在2018年的三星Galaxy S8上,具体请见Android Demo APP)



    pip install PyTorchVideo


    • 安装的虚拟环境的python版本 >= 3.7
    • PyTorch >= 1.8.0,安装的torchvision也需要匹配
    • CUDA >= 10.2
    • ioPath
    • fvcore版本 >= 0.1.4

    Model zoo 和 benchmark

    在下面这部分,将简单介绍些PyTorchVideo所提供的Model zoo和benchmark

    • Kinetics-400
    archdepthpretrainframe length x sample ratetop 1top 5Flops (G) x viewsParams (M)Model
    C2DR50-8x871.4689.6825.89 x 3 x 1024.33link
    I3DR50-8x873.2790.7037.53 x 3 x 1028.04link
    SlowR50-4x1672.4090.1827.55 x 3 x 1032.45link
    SlowR50-8x874.5891.6354.52 x 3 x 1032.45link
    SlowFastR50-4x1675.3491.8936.69 x 3 x 1034.48link
    SlowFastR50-8x876.9492.6965.71 x 3 x 1034.57link
    SlowFastR101-8x877.9093.27127.20 x 3 x 1062.83link
    SlowFastR101-16x878.7093.61215.61 x 3 x 1053.77link
    CSNR101-32x277.0092.9075.62 x 3 x 1022.21link
    R(2+1)DR50-16x476.0192.2376.45 x 3 x 1028.11link
    X3DXS-4x1269.1288.630.91 x 3 x 103.79link
    X3DS-13x673.3391.272.96 x 3 x 103.79link
    X3DM-16x575.9492.726.72 x 3 x 103.79link
    X3DL-16x577.4493.3126.64 x 3 x 106.15link
    MViTB-16x478.8593.8570.80 x 1 x 536.61link
    MViTB-32x380.3094.69170.37 x 1 x 536.61link
    • Something-Something V2
    archdepthpretrainframe length x sample ratetop 1top 5Flops (G) x viewsParams (M)Model
    SlowR50Kinetics 4008x860.0485.1955.10 x 3 x 131.96link
    SlowFastR50Kinetics 4008x861.6886.9266.60 x 3 x 134.04link
    • Charades
    archdepthpretrainframe length x sample rateMAPFlops (G) x viewsParams (M)Model
    SlowR50Kinetics 4008x834.7255.10 x 3 x 1031.96link
    SlowFastR50Kinetics 4008x837.2466.60 x 3 x 1034.00link
    • AVA (V2.2)
    archdepthpretrainframe length x sample rateMAPParams (M)Model
    SlowR50Kinetics 4004x1619.531.78link
    SlowFastR50Kinetics 4008x824.6733.82link

    使用 PyTorchVideo model zoo


    • TorchHub,这些模型都已经在TorchHub存在。可以根据实际情况来选择需不需要使用预训练模型。除此之外,官方也给出了TorchHub使用的tutorial
    • PySlowFast,使用 PySlowFast workflow 去训练或测试PyTorchVideo models/datasets
    • PyTorch Lightning建立一个工作流进行处理,点击查看官方tutorial







    • 数据集(dataset)定义方式不同
    • 数据预处理工具
    • 没有琳琅满目的model zoo



    • 数据处理工具 torchtext.data.functionaltorchtext.data.utils
    • 数据集 torchtext.data.datasets
    • 词表工具 torchtext.vocab
    • 评测指标 torchtext.metrics



    pip install torchtext




    torchtext 认为一个样本是由多个字段(文本字段,标签字段)组成,不同的字段可能会有不同的处理方式,所以才会有 Field 抽象。




    • https://stackoverflow.com/questions/66516388/attributeerror-module-torchtext-data-has-no-attribute-field
    from torchtext import data
    tokenize = lambda x: x.split()
    TEXT = data.Field(sequential=True, tokenize=tokenize, lower=True, fix_length=200)
    LABEL = data.Field(sequential=False, use_vocab=False)


    • sequential设置数据是否是顺序表示的

    • tokenize用于设置将字符串标记为顺序实例的函数

    • lower设置是否将字符串全部转为小写

    • fix_length设置此字段所有实例都将填充到一个固定的长度,方便后续处理

    • use_vocab设置是否引入Vocab object,如果为False,则需要保证之后输入field中的data都是numerical的


    from torchtext import data
    def get_dataset(csv_data, text_field, label_field, test=False):
        fields = [("id", None),  # we won't be needing the id, so we pass in None as the field
                     ("comment_text", text_field), ("toxic", label_field)]       
        examples = []
        if test:
            # 如果为测试集,则不加载label
            for text in tqdm(csv_data['comment_text']):
                examples.append(data.Example.fromlist([None, text, None], fields))
            for text, label in tqdm(zip(csv_data['comment_text'], csv_data['toxic'])):
                examples.append(data.Example.fromlist([None, text, label], fields))
        return examples, fields


    train_data = pd.read_csv('train_toxic_comments.csv')
    valid_data = pd.read_csv('valid_toxic_comments.csv')
    test_data = pd.read_csv("test_toxic_comments.csv")
    TEXT = data.Field(sequential=True, tokenize=tokenize, lower=True)
    LABEL = data.Field(sequential=False, use_vocab=False)
    # 得到构建Dataset所需的examples和fields
    train_examples, train_fields = get_dataset(train_data, TEXT, LABEL)
    valid_examples, valid_fields = get_dataset(valid_data, TEXT, LABEL)
    test_examples, test_fields = get_dataset(test_data, TEXT, None, test=True)
    # 构建Dataset数据集
    train = data.Dataset(train_examples, train_fields)
    valid = data.Dataset(valid_examples, valid_fields)
    test = data.Dataset(test_examples, test_fields)


    # 检查keys是否正确
    # 抽查内容是否正确


    在NLP中,将字符串形式的词语(word)转变为数字形式的向量表示(embedding)是非常重要的一步,被称为Word Embedding。






    from torchtext.data import Iterator, BucketIterator
    # 若只针对训练集构造迭代器
    # train_iter = data.BucketIterator(dataset=train, batch_size=8, shuffle=True, sort_within_batch=False, repeat=False)
    # 同时对训练集和验证集进行迭代器的构建
    train_iter, val_iter = BucketIterator.splits(
            (train, valid), # 构建数据集所需的数据集
            batch_sizes=(8, 8),
            device=-1, # 如果使用gpu,此处将-1更换为GPU的编号
            sort_key=lambda x: len(x.comment_text), # the BucketIterator needs to be told what function it should use to group the data.
    test_iter = Iterator(test, batch_size=8, device=-1, sort=False, sort_within_batch=False)




    Text Classification
    • AG_NEWS
    • AmazonReviewFull
    • AmazonReviewPolarity
    • DBpedia
    • IMDb
    • SogouNews
    • SST2
    • YahooAnswers
    • YelpReviewFull
    • YelpReviewPolarity
    Language Modeling
    • PennTreebank
    • WkiText-2
    • WikiText103
    Machine Translation
    • IWSLT2016
    • IWSLT2017
    • Multi30k
    • Sequence Tagging
    • CoNLL2000Chunking
    • UDPOS
    Question Answer
    • SQuAD 1.0
    • SQuAD 2.0
    Unsupervised Learning
    • CC100
    • EnWik9



    比如机器翻译任务常用BLEU (bilingual evaluation understudy) score来评价预测文本和标签文本之间的相似程度。


    from torchtext.data.metrics import bleu_score
    candidate_corpus = [['My', 'full', 'pytorch', 'test'], ['Another', 'Sentence']]
    references_corpus = [[['My', 'full', 'pytorch', 'test'], ['Completely', 'Different']], [['No', 'Match']]]
    bleu_score(candidate_corpus, references_corpus)






  • 'right_eye','left_ear','right_ear','left_shoulder','right_shoulder','left_elbow','right_elbow','left_wrist','right_wrist','left_hip','right_hip','left_knee','right_knee','left_ankle','right_ankle'] ...
  • 发现在特征明显时图片分类准确度较高,如对背景干净,特征清晰的金鱼达到了0.999884的置信度,1: 'goldfish, Carassius auratus',也存在图片分类错误的情况存在,如对于玉米进行检测时998: 'ear, spike, capitulum'...
  • Task04:PyTorch生态简介

    2022-03-23 14:41:27
    ear','right_ear','left_shoulder','right_shoulder','left_elbow','right_elbow','left_wrist','right_wrist','left_hip','right_hip','left_knee','right_knee','left_ankle','right_ankle'] 同样的,我们可以点击...
  • 一个倒吊人小游戏

    千次阅读 2022-04-30 13:46:46
    'bring', 'britain', 'broadcast', 'brother', 'brown', 'brush', 'build', 'building', 'bund', 'burn', 'bus', 'business', 'businessman', 'busy', 'but', 'butter', 'butterfly', 'button', 'buy', 'by', 'bye'...
  • "build model started" ) start_time = time . time ( ) rgb_scaled = images * 255.0 red , green , blue = tf . split ( rgb_scaled , 3 , 3 ) # 从rgb转成bgr bgr = tf . concat ( [ ...
  • 题目描述 从前有个很厉害的人物演讲了一堆很厉害的东西,可是我读书少,认识人不多,你知道这个人叫啥不。。 答案格式wctf{名字} 友情提示1、外国人,只要名字就可以了,就别要姓了,首字母大写。...
  • heart revolving_hearts cupid love_letter kiss ring gem bust_in_silhouette busts_in_silhouette speech_balloon footprints thought_balloon dog wolf cat mouse hamster rabbit frog tiger koala bear pig pig_...
  • 爬虫抓取加入网页中

    千次阅读 2022-01-11 09:54:30
    'beam', 'bean', 'bear', 'beard', 'bearing', 'beast', 'beat', 'beautiful', 'beauty', 'because', 'become', 'bed', 'bee', 'beef', 'beer', 'before', 'beforehand', 'beg', 'begin', 'beginning', 'behalf', '...
  • But, what should we do to be a good doctorChen Xuqing who works in the ear-nose-throat department maybe can tell us:‘A good doctor must be responsible, because patients put their health in doctors’...
  • 77 ran, 75 ue, 74 and, 74 int, 73 do, 71 ten, 71 able, 62 ear, 62 our, 62 era, 59 end, 59 act, 57 age, 56 mm, 56 eve, 55 ph, 53 ass, 52 man, 49 art, 49 up, 47 ill, 47 cat, 47 eat, 45 mat, 43 tan, 43 ...
  • banknote : #> banner : #> bar : ⏸⏭️⏮️⏯️⏸️ #> barber : #> bat : #> bath : ♨ #> bathroom : #> bathtub : #> beach : ‍♀️☀️ #> bear : #> beard : #> bearer : ♒⛎ #> beauty : #> beef : #> ...
  • 问题说明: 从标准输入中读入一个英文单词及查找方式,在一个给定的英文常用单词字典文件dictionary3000.txt中查找该单词,返回查找结果(查找到返回1,否则返回0)和查找过程中单词的比较次数。...
  • After hearing the funny story , all of us couldn't help laughing ear to ear. 听完了那个滑稽故事,我们忍不住大笑了。 Excuse my interrupting you for a while . 请原谅我打扰你一会儿。 Prof. Smith ...
  • 点击上方“优冠教育”关注我们优冠教育 让孩子向冠军冲刺我们在初高中学习英语...有一个year(年)天空很clear(晴朗)下有个bear(狗熊)被割掉ear(耳朵),气跑了dear(爱人)想起了swear(誓言)流出了tear(眼泪)把眼镜wear(...
  • For example, if you wanted to build an API which manages user information, from adding them to an app to erasing their profiles, then these are some of the nouns you might want to use: 例如,如果您想...
  • 背单词(持续更新)

    千次阅读 2021-01-30 09:29:54
    新概念英语 claim the protection of the law corner sb: 堵住 possession: 财产 hava lots of complaints about the hotel an accumulation of work to be done puma美洲狮-leopard猎豹 feel obliged(grateful) ...
  • import collections f=open("D:\python\Walden.txt","r").read() f=f.replace(',','').replace('.','').replace('"','').replace(':','') f=f.split() r=collections.Counter(f) print(r) ...Counter({'the': 6937,...
  • walden

    千次阅读 2020-11-18 21:56:21
    t=open("D:\python\Walden","r").read() t=t.replace(',','').replace('.','').replace('"','').replace(':','') t=t.split() r=collections.Counter(t) print(r) Counter({'the': 6937, 'and': 4547, 'of': 3472...
  • 《Walden》单词词频统计

    千次阅读 2020-11-15 19:02:32
    《Walden》单词词频统计 import collections #创建一个新的容器 f = open('E:\学习文件夹\Walden.txt', 'r').read() #打开本地文本文件,r表示以读取方式打开 f = f.replace(',','').replace('.','').replace('"',...
  • 四级英语词汇大全

    千次阅读 2020-12-22 10:29:16
    a art.一(个);每一(个) a.m (缩)上午,午前 abandon vt.丢弃;放弃,抛弃 abbreviation n.节略,缩写,缩短 ability n....able a....abnormal a....aboard ad....abolish vt....about prep....above prep....absence n....absent a....
  • 网络编程_8(项目附件)

    万次阅读 2021-01-13 13:27:09
    dict.txt abandonment n.放弃 abbreviation n.缩写 abeyance n.缓办,中止 abide v....ability n....able adj....abnormal adj....aboard adv....abolish v....abolition n....abortion n....abortive adj....about prep....ab
  • walden2

    2020-11-19 11:43:26
    #打开并读取文件 file=open(r'c:\Users\Administrator\Desktop\Walden.txt','r') lines=file.readlines() #要把每行拆成单词 words=[] for line in lines: tmp_list =line.split(" ") for word in tmp_list: ...
  • 导致 114 build up one's health 健体强身 build a good reputation 树林名誉 115 burn to the ground 把。。烧光 burn sth. down 焚为平地 burn up 烧(旺)起来 116 burst out( crying) 爆发 burst into ( ...



1 2 3 4 5 ... 9
收藏数 178
精华内容 71

build ear(bear)