text stringlengths 1 93.6k |
|---|
# If the current frame-number exceeds the speed frames_per_image...
|
if self.frame_counter >= self.sprite_order[self.current_sprite][1]:
|
# Increase the index of the current sprite
|
self.current_sprite += 1
|
# If the index of the current frame is higher than the length of sprites available, reset it to 0
|
if self.current_sprite >= len(self.sprite_order):
|
self.current_sprite = 0
|
# Clean up the surface
|
self.surface.blit(self.empty_surface, (0, 0))
|
# Blit the image of the new frame onto the surface
|
self.surface.blit(self.sprites[self.sprite_order[self.current_sprite][0]], (0, 0))
|
# Reset the frame_counter
|
self.frame_counter = 0
|
return self
|
def get_spritenr(self):
|
"""
|
Returns the index of the current sprite displayed.
|
"""
|
return self.current_sprite
|
def get_animation_length(self):
|
return len(self.sprite_order)
|
def get_surface(self):
|
"""
|
Returns the current surface.
|
"""
|
return self.surface
|
def make_x_mirror(self):
|
"""
|
Mirrors every image of the animation on the x axis.
|
Useful for e.g. walk- or jump-animations.
|
"""
|
new_sprites = [pygame.transform.flip(surf, 1, 0) for surf in self.sprites]
|
return self.copy(new_sprites, self.sprite_order)
|
def make_y_mirror(self):
|
"""
|
Mirrors every image of the animation on the y axis.
|
Useful for e.g. walk- or jump-animations.
|
"""
|
new_sprites = [pygame.transform.flip(surf, 0, 1) for surf in self.sprites]
|
return self.copy(new_sprites, self.sprite_order)
|
def make_xy_mirror(self):
|
"""
|
Mirrors every image of the animation on the x- and the y-axis.
|
Useful for e.g. walk- or jump-animations.
|
"""
|
new_sprites = [pygame.transform.flip(surf, 1, 1) for surf in self.sprites]
|
return self.copy(new_sprites, self.sprite_order)
|
# <FILESEP>
|
# --------------------------------------------------------
|
# Tensorflow Faster R-CNN
|
# Licensed under The MIT License [see LICENSE for details]
|
# Written by Jiasen Lu, Jianwei Yang, based on code from Ross Girshick
|
# --------------------------------------------------------
|
from __future__ import absolute_import
|
from __future__ import division
|
from __future__ import print_function
|
import _init_paths
|
import os
|
import sys
|
import numpy as np
|
import argparse
|
import pprint
|
import pdb
|
import time
|
import cv2
|
import torch
|
from torch.autograd import Variable
|
import torch.nn as nn
|
import torch.optim as optim
|
import pickle
|
from roi_data_layer.roidb import combined_roidb
|
from roi_data_layer.roibatchLoader import roibatchLoader
|
from model.utils.config import cfg, cfg_from_file, cfg_from_list, get_output_dir
|
from model.rpn.bbox_transform import clip_boxes
|
from model.nms.nms_wrapper import nms
|
from model.rpn.bbox_transform import bbox_transform_inv
|
from model.utils.net_utils import save_net, load_net, vis_detections
|
import pdb
|
try:
|
xrange # Python 2
|
except NameError:
|
xrange = range # Python 3
|
def parse_args():
|
"""
|
Parse input arguments
|
"""
|
parser = argparse.ArgumentParser(description='Train a Fast R-CNN network')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.